Repository navigation
API Enable metadata auto requests by default - #35204
StefanieSenger merged 21 commits into
Conversation
…o-requests-default Co-authored-by: Cursor <[email protected]> # Conflicts: # doc/metadata_routing.rst
StefanieSenger
left a comment
There was a problem hiding this comment.
Thanks for the PR, @antoinebaker. This PR looks good to me, and I only have a few minor cosmetic suggestions.
Co-authored-by: Stefanie Senger <[email protected]>
Co-authored-by: Stefanie Senger <[email protected]>
|
Thanks for the quick review @StefanieSenger and the helpful suggestions ! Apart from the "sections reordering" to decide, I think all your comments have been addressed. |
StefanieSenger
left a comment
There was a problem hiding this comment.
Thanks for the quick implementation of the suggestions, @antoinebaker.
I agree that we'd better leave a user guide re-design to a different PR.
Approving. :)
FrancoisPgm
left a comment
There was a problem hiding this comment.
I have a few nits, mainly changing a bit the wording to make it clearer IMO.
Also cursor detected some small things to address :
- the sample_weight glossary entry still describes the old default (glossary.rst L1957)
- in MetadataRouter's docstring (_metadata_requests.py L1024) it should be
'score': {'sample_weight': True}now, as the scorer auto-requests sample_weight. Also the.set_fit_request(sample_weight=True)on L1012 is redundant with the new default. If the goal is to show a case where the requests for fit and score are different, enable_metadata_auto_requests should be disabled and re-enabled around the code snippet. - test_default_request and test_default_requests mention requests "by default" or "default requests" in comments while their decorators force enable_metadata_auto_requests=False. It could be better to mention in the comments that these are the defaults when auto-requests are disabled.
There is also a point about the user guide (metadata_routing.rst) turning auto-requests off at the beginning, then much later presenting auto-requests off behaviour as the general rule (L245-263). A short sentence to remind that the default has been changed could be nice before the bigger rework of the guide in a subsequent PR, but this seems less important.
Other than that LGTM, thanks :)
Co-authored-by: François Paugam <[email protected]>
|
Love this PR. Thank you @antoinebaker and @FrancoisPgm! 🫶 Merging. 🚀 Note for downstream projects When metadata routing is enabled, Auto-requests only take action on scikit-learn estimators and (possibly user defined) scorers, and among these, metadata is routed to new places and some Downstream projects can either use To fully participate in the auto-request policy in their own estimators, third party projects can inherit from Please report any new errors. Changes in training and scoring results are expected. |
Reference Issues/PRs
See #34901.
What does this implement/fix? Explain your changes.
enable_metadata_auto_requestsnow defaults to True. Once routing is on, scikit-learn consumers auto-request metadata such as sample_weight, X_val, y_val, sample_weight_val. Third-party estimators are unchanged unless they useAutoRequestMixin.Many tests were written for the old configuration (enable_metadata_auto_requests=False), so this flag is added in the @config_context decorator of these tests.
AI usage disclosure
I used AI assistance for:
Any other comments?
To be merged last, after the implementation and documentation PRs listed here #34901 (comment).
cc @ogrisel @StefanieSenger