我指的是下面的链接和示例,并从本页发布我感到困惑的绘图。我的困惑是,只有 4 个阈值,但 roc 曲线似乎有很多数据点(> 4 个数据点),想知道 roc_curve 底层如何工作以找到更多数据点?
http://scikit-learn.org/stable/modules/model_evaluation.html#roc-metrics http://scikit-learn.org/stable/modules/model_evaluation.html#roc-metrics
>>> import numpy as np
>>> from sklearn.metrics import roc_curve
>>> y = np.array([1, 1, 2, 2])
>>> scores = np.array([0.1, 0.4, 0.35, 0.8])
>>> fpr, tpr, thresholds = roc_curve(y, scores, pos_label=2)
>>> fpr
array([ 0. , 0.5, 0.5, 1. ])
>>> tpr
array([ 0.5, 0.5, 1. , 1. ])
>>> thresholds
array([ 0.8 , 0.4 , 0.35, 0.1 ])