-
-
Notifications
You must be signed in to change notification settings - Fork 25.8k
ENH allow to pass str or scorer to make_scorer #18141
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.
With this update, is there any reason to keep get_scorer
as public api?
This is true that it could only be private then. |
If this is only used to modify |
Indeed, it makes the parameters bypassing less odd I think. My only concern is about the documentation and how we can do to make this part understandable.
For the second point, I think that we should raise a better error message. Usually, a user will use a CV object and get something that he needs to explicitly pass some parameters. I don't know if we can easily detect who is calling the scoring function (a CV object or the user directly) but we could at least mention that if you use a CV object, use |
I think |
I think allowing make_scorer to take a string, and nominally to modify
whether greater is better when you do so is super awkward. So if we really
need another verb like customize_scorer, so be it (I'd rather not), but I
suspect I'd vote against allowing a string in make_scorer as giving it too
much mixed responsibility.
|
I agree to not have another function.
Thinking it over, passing @glemaitre Should we close this and try to move forward with #17962? |
I am fine closing. But this is still not clear where to we go forward. Are we ok with:
|
Adding As for this specific issue with "adjusting a str represented by a scorer", adding |
Would we also get the list of params from the signature of the underlying
function? We'll have to test if that works nicely with partials etc.
|
Now that we have #22866 and
If it is a callable, I see two options:
From an API point of view, I prefer to only support strings in |
So 2 years later, looking at all the different changes I have the following opinion:
So I assume that this should be part of the discussion of the potential future |
This PR proposes to add the option to pass a scoring function name or a scorer in order to build a scorer via
make_scorer
.In some way, it would simplify the scorer API. For instance, the following example is raising an error because the class 9 is not present in the fold during cross-validation:
The way to solve it is to use a scorer. However, one needs to know what all the
make_scorer
parameters mean:I am thinking that the following would be simpler where some parameters can be inferred from the base scorer.