-
-
Notifications
You must be signed in to change notification settings - Fork 25.8k
FIX pos_label constraint in roc_curve (param validation) #25131
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FIX pos_label constraint in roc_curve (param validation) #25131
Conversation
sklearn/metrics/_ranking.py
Outdated
@@ -723,7 +723,7 @@ def _binary_clf_curve(y_true, y_score, pos_label=None, sample_weight=None): | |||
y_score : ndarray of shape (n_samples,) | |||
Estimated probabilities or output of a decision function. | |||
|
|||
pos_label : int or str, default=None | |||
pos_label : int, float or str, default=None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we add bool
as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
right, I forgot
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not really like how float
s can be a classification target, but it is what we support according to type_of_target
:
from sklearn.utils.multiclass import type_of_target
import numpy as np
X = np.asarray([1.0, 2.0, 1.0, 2.0])
type_of_target(X)
# 'binary'
As for this PR, LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM as well. Yep float
is surprising but I would not be surprised that we have use cases with them
Merging with 2 approvals |
Closes #25130
ping @glemaitre @thomasjpfan