Lin*_* Ma 5 python machine-learning python-2.7 roc scikit-learn
我指的是下面的链接和示例,并在此页面上张贴了混淆的图。我的困惑是,只有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 ])
Run Code Online (Sandbox Code Playgroud)
该图实际上来自这个示例:http://scikit-learn.org/stable/auto_examples/model_selection/plot_roc.html
| 归档时间: |
|
| 查看次数: |
7701 次 |
| 最近记录: |