Thresholds can exceed 1 in roc_curve
while providing probability estimate
#26193
Labels
roc_curve
while providing probability estimate
#26193
While working on #26120, I found out that something was odd with
roc_curve
that returns a threshold greater than 1. A non-regression test (that could be part ofsklearn/metrics/tests/test_ranking.py
) could be as follow:The reason is due to the following:
scikit-learn/sklearn/metrics/_ranking.py
Line 1086 in e886ce4
Basically, this is to add a point for
fpr=0
andtpr=0
. However, the+ 1
rule does not make sense in the casey_score
is a probability estimate.I am not sure what would be the best fix here. A potential workaround would be to check
thresholds.max() <= 1
in which case we should clipthresholds
to not be above 1.The text was updated successfully, but these errors were encountered: