-
-
Notifications
You must be signed in to change notification settings - Fork 26.5k
ENH Add warning when only one label found in confusion_matrix
#27650
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
Conversation
sklearn/metrics/_classification.py
Outdated
| if cm.shape == (1, 1): | ||
| warnings.warn( | ||
| ( | ||
| "Only one label was found in 'y_true' and 'y_pred', use the 'labels' " |
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.
| "Only one label was found in 'y_true' and 'y_pred', use the 'labels' " | |
| "A single label is found in 'y_true' and 'y_pred', use the 'labels' " |
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.
This is nicer!
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.
Could you also add an entry in the changelog and a non-regression test?
Per the discussion, the resolution is fine to me.
Thanks @lucyleeow
confusion_matrixconfusion_matrix
|
Done thank you @glemaitre ! |
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. Thanks @lucyleeow
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. Thanks @lucyleeow
Reference Issues/PRs
fixes #19756
What does this implement/fix? Explain your changes.
Add warning when only one label found in
confusion_matrixand advise user to pass all labels vialabelsparameter.