R's ROCR package provides options for ROC curve plotting that will color code and label threshold values along the curve:
R的ROCR软件包提供了ROC曲线绘制的选项,它将沿着曲线绘制颜色代码和标签阈值:
The closest I can get with Python is something like
与Python最接近的是类似的东西
from sklearn.metrics import roc_curve
fpr, tpr, thresholds = roc_curve(qualityTrain.PoorCare, qualityTrain.Pred1)
plt.plot(fpr, tpr, label='ROC curve', color='b')
plt.axes().set_aspect('equal')
plt.xlim([-0.05, 1.05])
plt.ylim([-0.05, 1.05])
which gives
这给了
Are there packages that provide functionality equivalent to R's ability to label (using print.cutoffs.at
) and color code (using colorize
) thresholds? Presumably this information is in thresholds
, returned by sklearn.metrics.roc_curve
, but I can't figure out how to use it to color code and label the figure.
是否有提供与R标记(使用print.cutoff .at)和颜色代码(使用着色)阈值功能相同的功能的包?假定该信息是阈值,由sklearn.metrics返回。roc_curve,但我不知道如何用它来给图形上色和贴标签。
1 个解决方案
#1
5
Look at this gist:
看看这个要点:
https://gist.github.com/podshumok/c1d1c9394335d86255b8
https://gist.github.com/podshumok/c1d1c9394335d86255b8
roc_data = sklearn.metrics.roc_curve(...)
plot_roc(*roc_data, label_every=5)
#1
5
Look at this gist:
看看这个要点:
https://gist.github.com/podshumok/c1d1c9394335d86255b8
https://gist.github.com/podshumok/c1d1c9394335d86255b8
roc_data = sklearn.metrics.roc_curve(...)
plot_roc(*roc_data, label_every=5)