ENH/DEPR add new response_method and deprecate needs_* in make_scorer#26840
Conversation
|
ping @betatim on this one ;) |
I kinda see why it is needed, but I also kinda don't like having an extra argument to If we settle on adding an argument to The bug fix part for |
thomasjpfan
left a comment
There was a problem hiding this comment.
Does resolving #26817 require a new respond_method? If they are unrelated, can this be split into two PRs?
- Adding multi-label-indicator support
- Add respond_method to adjust the order for
needs_threshold=True
…to make_scorer_list_response
|
I open #27002 to solve the issue of multilabel-indcator on a separate PR. I am putting this PR on draft until merging the other PR. The other PR will target 1.3.1. |
|
Going back to this PR now that we solve the multi-label bug and I need this PR for #26120. |
This is exactly this. I would like to favor
We can error when passing something to this new argument while not setting |
|
Maybe @betatim @thomasjpfan you want to have a new look at this one. |
There was a problem hiding this comment.
I'm finding the combination of needs_proba, needs_threshold and response_method confusing. Seems like with the introduction of response_method we can deprecated one of needs_proba/needs_threshold
Specifically, seems like we can deprecate _ProbaScorer?
I also kinda feel like the changes here aren't tested, but codecov obviously doesn't agree 😁
(didn't mean to "approve" 😝 )
I think that we can deprecate both of them indeed: if |
| # Score functions that need decision values | ||
| top_k_accuracy_scorer = make_scorer( | ||
| top_k_accuracy_score, greater_is_better=True, needs_threshold=True | ||
| top_k_accuracy_score, |
There was a problem hiding this comment.
Whatever changes below is only because of the new API.
glemaitre
left a comment
There was a problem hiding this comment.
I added a couple of comments to help at reviewing this PR.
Usually, the complex part is about the caching mechanism and _MultimetricScorer.
Co-authored-by: Adrin Jalali <adrin.jalali@gmail.com>
Co-authored-by: Adrin Jalali <adrin.jalali@gmail.com>
|
Deprecation warnings making tests fail, otherwise LGTM. |
thomasjpfan
left a comment
There was a problem hiding this comment.
Thanks for the PR! Overall LGTM
…scikit-learn#26840) Co-authored-by: Adrin Jalali <adrin.jalali@gmail.com> Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>
…scikit-learn#26840) Co-authored-by: Adrin Jalali <adrin.jalali@gmail.com> Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>
closes #26817
While working in #26120, I find myself doing dirty tricks to overwrite the response method used in
_ThresholdScorerwhile we should be able to pass a list of priorities and delegate to_get_response_values.I introduce
response_methodinmake_scorerthat remove the need toneeds_probaandneeds_threshold. I assume that the API is simplified due to the work done with_get_response_values. Now, we don't need to have different type of scorers (i.e._PredictScorer,_ProbaScorer, andThresholdScorer). All are handled in a single class because all the complexity is delegated to the_get_response_valuesto which we provide the response method to try.I need to alternate the provided
scorerin the_MultiMetricScorerto be sure to hit the cache. It means that we need to decide on a single method to use for a single estimator. At the end, it simplifies also when the cache policy is beneficial.