machine-learning - sklearn 的 roc_curve() 函数返回不同维度的阈值和 fpr
问题描述
我假设roc_curve()
为每个阈值计算 fpr 和 tpr。但是下面的代码显示 fpr 和 thresholds 有不同的维度。
from sklearn.metrics import roc_curve
fpr,tpr,thresholds = roc_curve(y_train_5,y_scores)
fpr.shape #(3908,)
thresholds.shape #(59966,)
我也想知道为什么
precisions,recalls,thresholds = precision_recall_curve(y_train_5,y_scores)
precisions #(59967,)
thresholds #(59966,)
精度的维度与阈值相差一个?
解决方案
推荐阅读
- c++ - 双重释放或损坏 C++
- atom-editor - 在 atom 中使用键盘在面板之间移动
- mongodb - 此基本设置忽略了猫鼬填充
- javascript - 尝试访问 Fortnite-API 时出现 UnhandledPromiseRejectionWarning?
- javascript - ES6 父类覆盖子原型
- google-apps-script - 如何在移动设备上禁用 Gmail 插件?
- yocto - 如何在 yocto AGL 中添加 pciutils 包?
- angular - 如何调用多个 API 并在 Angular 6 中订阅?
- javascript - js中不同的动画效果
- java - jersey2 的 Web.xml 不允许来自其他应用程序的休息调用