-
-
Notifications
You must be signed in to change notification settings - Fork 25.8k
[MRG+1] more explicit error message when multiple scores passed #11008
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
Thanks for the PR @minggli ! There is one test failing in |
thanks! fixed. 😀 |
LGTM. |
sklearn/metrics/scorer.py
Outdated
@@ -300,6 +300,10 @@ def check_scoring(estimator, scoring=None, allow_none=False): | |||
"If no scoring is specified, the estimator passed should " | |||
"have a 'score' method. The estimator %r does not." | |||
% estimator) | |||
elif isinstance(scoring, (list, tuple, set, dict)): |
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.
Can be more permissive and ducktype:
from collections import Iterable
...
elif isinstance(scoring, Iterable):
...
And add an entry in the what's new as well. |
doc/whats_new/v0.20.rst
Outdated
@@ -204,6 +204,10 @@ Model evaluation and meta-estimators | |||
return estimators fitted on each split. :issue:`9686` by :user:`Aurélien Bellet | |||
<bellet>`. | |||
|
|||
- Add improved error message in :func:`model_selection.cross_val_score` when |
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 should be in the Bug Fixes section instead
LGTM |
Thanks @minggli |
happy to contribute! |
Reference Issues/PRs
Fixes #11006. See also #3456.
What does this implement/fix? Explain your changes.
Add a more explicit message when one of below is passed to
scoring=
keyword in cross_val_score: list, set, tuple, dict. It prompts user to use cross_validate for multiple metrics evaluation.Any other comments?