-
-
Notifications
You must be signed in to change notification settings - Fork 26k
API get_scorer returns a copy and introduce get_scorer_names #22866
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
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'm happy with this approach.
I think this PR also resolves #17942
This makes the code of get_scorer less readable since the usual lookup semantics aren’t followed. At a minimum get_scorer needs an update to its docs and probably a comment. Might also be worth reconsidering if this is too hacky and we would be better off deprecating SCORERS and adding get_scorer_names, providing less magic with a public/private distinction. I’m not sure to what extent users/ third parties update SCORERS. |
This is a valid point.
I would greatly prefer adding a |
Ok, I've introduced |
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.
Thanks for the update. Title for the PR needs to be updated too.
classes.rst should also be updated |
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!
@jnothman happy to merge? |
Ping @glemaitre |
@jnothman did you mean to close or merge? |
To merge! :| |
EDIT: This PR now introduces a new
get_scorer_names
, makesget_metric
to return a copy, and deprecatedSCORERS
.OLD:
This PR makes
SCORERS[scorer_name]
to return a copy rather than the original object. This also meansget_scorer
returns a copy each time.cc @thomasjpfan @jnothman @glemaitre @lorentzenchr
Note that this is to be merged into
main
.Closes #17942