【发布时间】:2017-01-02 12:18:18
【问题描述】:
我指的是下面的链接和示例,并在我感到困惑的地方发布了此页面的绘图图。我的困惑是,只有 4 个阈值,但似乎 roc 曲线有很多数据点(> 4 个数据点),想知道 roc_curve 如何在底层工作以找到更多数据点?
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 ])
【问题讨论】:
标签: python python-2.7 machine-learning scikit-learn roc