tr7200 / Youdens_index

PyTorch and Tf-Keras implementations of an epidemiology metric from Kaivanto (2008), suitable for imbalanced data

Home Page:https://d1wqtxts1xzle7.cloudfront.net/50608735/Maximization_of_the_sum_of_sensitivity_a20161129-31300-uod3px.pdf?1480411817=&response-content-disposition=inline%3B+filename%3DMaximization_of_the_sum_of_sensitivity_a.pdf&Expires=1592161108&Signature=aZUQY9

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Youdens_index

Youden's index, a metric for imbalanced data with Tensorflow-Keras and PyTorch. Keras 2.2.4 and Tensorflow 1.13.

Custom Keras metric that measures the maximization of sensitivity and specificity following Kaivanto (2008):

Kaivanto, K. (2008).
Maximization of the sum of sensitivity and specificity as a diagnostic cutpoint criterion
Journal of clinical epidemiology, 61, 516-518.

Imbalanced datasets need a custom metric function is used to help evaluate the best epoch to use for prediction. Youden's index is one such metric. It is a measure from epidemiology that is somewhat similar to the geometric mean of the sum of sensitivity and specificity, a measure that is often used to score machine learning models with imbalanced data He and Garcia 2009.

Usage:

model = Sequential()
...
model.compile(..., metrics=['accuracy', youdens_index], ...)

result = model.fit(train_x,
                   train_y,
                   ...)

This metric is suitable for training with imbalanced classification models.

python setup.py install to install.

MIT License