- scikit-learn has convenient functions for calculating the sensitivity or TPR for the logistic regression given a vector of probabilities of the positive class, y_pred_proba[:,1]:
from sklearn.metrics import roc_curvefpr, tpr, ths = roc_curve(y_test, y_pred_proba[:,1])
Here, given the positive class vector, the roc_curve function in scikit-learn yielded a tuple of three arrays:
- The TPR array (denoted by tpr)
- The FPR array (denoted by fpr)
- A custom set of thresholds to calculate TPR and FPR (denoted by ths)
To elaborate on the false positive rate (FPR), it describes the rate of false alarms. It is the number of people incorrectly thought to have diabetes although they do not:
It is a statement of people ...