scikit中roc_curve中的阈值学习 [英] thresholds in roc_curve in scikit learn

查看:569
本文介绍了scikit中roc_curve中的阈值学习的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我指的是下面的链接和示例,并在我感到困惑的页面上发布了绘图图.我的困惑是,只有4个阈值,但是roc曲线似乎有很多数据点(> 4个数据点),想知道roc_curve如何在底层工作以找到更多数据点?

I am referring to the below link and sample, and post the plot diagram from this page where I am confused. My confusion is, there are only 4 threshold, but it seems the roc curve has many data points (> 4 data points), wondering how roc_curve working underlying to find more data points?

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 ])

推荐答案

该图实际上来自以下示例: http://scikit-learn.org/stable/auto_examples/model_selection/plot_roc.html

That plot is actually from this example: http://scikit-learn.org/stable/auto_examples/model_selection/plot_roc.html

这篇关于scikit中roc_curve中的阈值学习的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆