问题
I understand that the ROC curve for a model is constructed by varying the threshold (that affects TPR, FPR).
Thus my initial understanding is that, to calculate the AUROC, you need to run the model many times with different threshold to get that curve and finally calculate the area.
But it seems like you just need some probability estimate of the positive class, as in the code example in sklearn's roc_auc_score below, to calculate AUROC.
>>> import numpy as np
>>> from sklearn.metrics import roc_auc_score
>>> y_true = np.array([0, 0, 1, 1])
>>> y_scores = np.array([0.1, 0.4, 0.35, 0.8])
>>> roc_auc_score(y_true, y_scores)
0.75
How does that work? Any recommended read?
来源:https://stackoverflow.com/questions/50014078/how-does-sklearn-actually-calculate-auroc