二元向量作为 roc_curve 的 y_score 参数 [英] Binary vectors as y_score argument of roc_curve
问题描述
sklearn roc_curve docstring 指出:
The sklearn roc_curve docstring states:
"y_score : 数组,形状 = [n_samples]目标分数可以是正类的概率估计、置信度值或二元决策."
"y_score : array, shape = [n_samples] Target scores, can either be probability estimates of the positive class, confidence values, or binary decisions."
在什么情况下将 y_score 设置为二元向量(二元决策")是有意义的?难道这不会导致 ROC 曲线上有一个点,这与该点相悖吗?
In what situation it would make sense to set y_score to a binary vector ("binary decisions")? Wouldn't that result in a ROC curve with one point on it which kind of defies the point?
推荐答案
如果您使用的分类器不输出概率分数(例如 svm.SVC
没有明确的 probability=True
),没有办法计算 ROC 曲线.作为 API 设计者,您有两种选择:引发异常并且不向用户提供任何有用信息,或者用一个数据点绘制退化曲线.我认为后者更有用.
If you are using a classifier that does not output probability scores (e.g. svm.SVC
without an explicit probability=True
), there isn't a way to compute a ROC curve. As an API designer, you have two choices: raise an exception and provide the user no useful information, or plot a degenerate curve with one data point. I would argue the latter is more useful.
这篇关于二元向量作为 roc_curve 的 y_score 参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!