Scikit-learn roc_curve:为什么阈值 [0] 设置为大于 1 的值?

Scikit-learn roc_curve: why is thresholds [0] set to have values ​greater than 1?

我知道要绘制看起来合理的 ROC 曲线,需要有一个包含 0 个数据点的阈值;但为什么不将此值设置为 1?
难道不应该理所当然地认为没有某些预测(即它们的概率等于 100%)吗?
查看默认设置似乎可以预测概率等于 1,我不明白为什么。

来自documentation

thresholds : ndarray of shape = (n_thresholds,)

Decreasing thresholds on the decision function used to compute fpr and tpr. thresholds[0] represents no instances being predicted and is arbitrarily set to max(y_score) + 1.

可以使用任何置信度度量来生成 ROC 曲线,而不仅仅是预测概率。特别是,在 sklearn 中,可以使用 decision_function 方法代替 predict_proba。 (这很重要;例如,SVM 不会自然地产生概率,但是到超平面的符号距离可以为 ROC 目的进行良好的排序。)

shouldn't it be taken for granted that there are no certain predictions (ie that they have a probability equal to 100%)?

这也不一定正确:具有纯叶的决策树的概率预测正好为 1,甚至逻辑回归模型也可能预测某些因数值精度限制而四舍五入为 1 的值。