Repository navigation
ENH Auto-requesting validation set for HistGradientBoosting* - #34957
Conversation
Co-authored-by: Stefanie Senger <[email protected]>
Co-authored-by: antoinebaker <[email protected]>
…n into default_routing3
|
The CI failure comes from the link to :ref: |
ogrisel
left a comment
There was a problem hiding this comment.
I think it would be good to showcase metadata routing of X_val and y_val in an example.
As far as I know was only done in past release release highlights.
I think we should have a dedicated example: for instance we could do a grid search of a pipeline with target encoder of categorical features + HistGradientBoosting on Ames housing.
We can either do that as part of this PR or in a follow-up PR.
| y_val=y_val, | ||
| sample_weight_val=sample_weight_val, | ||
| ) | ||
|
|
There was a problem hiding this comment.
Shall we also expect UnsetMetadataPassedError to be raised if the user sets .set_fit_request(X_val=False) explicitly under a with config_context(enable_metadata_auto_requests=True) block?
I would expect so (I think).
There was a problem hiding this comment.
I don't think so. UnsetMetadataPassedError is raised when a metadata request is set to None. If it's set explicitly by a user (True, False or an alias) it counts as a request set.
scikit-learn/sklearn/exceptions.py
Lines 21 to 23 in 8578499
There was a problem hiding this comment.
What I mean is expand this test further to then call .set_fit_request(X_val=False) and issue the same pipe.fit call afterwards and check that UnsetMetadataPassedError in that case.
Would it makes sense?
There was a problem hiding this comment.
If I remember correctly, an explicit .set_fit_request(X_val=False) means that the router (pipeline) will not pass X_val to the consumer (HGBT) and no error is raised. The error is raised only when X_val=None.
Yes, that's great idea. I'm happy to take care of this in a follow-up PR. |
ogrisel
left a comment
There was a problem hiding this comment.
LGTM. +1 for expanding the examples in a follow-up PR.
cakedev0
left a comment
There was a problem hiding this comment.
I don't have a lot of context on metadata routing, but the changes seems very sound and my agent thinks too, so it feels enough to approve.
Just a tiny typo to fix first.
|
|
||
| In a :class:`~pipeline.Pipeline`, `X_val` is transformed like `X` by default | ||
| (`transform_input`). Passing it through the pipeline requires metadata | ||
| routing; with auto-requests also enabled, `X_val`, `_val` and |
There was a problem hiding this comment.
Typo: _val -> y_val
| routing; with auto-requests also enabled, `X_val`, `_val` and | |
| routing; with auto-requests also enabled, `X_val`, `y_val` and |
| routing; with auto-requests also enabled, `X_val`, `_val` and | ||
| `sample_weight_val` are requested automatically | ||
| (:func:`~sklearn.set_config`). See | ||
| :ref:`metadata_routing_auto_request_user`. |
There was a problem hiding this comment.
Yea, I think we better wait until its merged to avoid a red CI on main.
antoinebaker
left a comment
There was a problem hiding this comment.
LGTM @StefanieSenger !
Could you ping me when the CI turns green (after the merge of #35019) ? I would like to proofread the rendered docs.
Yes, I will do that. Thank you @antoinebaker! |
I've just updated this branch (after #35019 had been merged into main). You can now have a look at the rendered docs, @antoinebaker. :) |
…-learn into auto-request_X_val
|
I checked the docs, LGMT ! |
|
Great, thanks a lot @antoinebaker. I will then merge this one. |
Reference Issues/PRs
towards #34901
What does this implement/fix? Explain your changes.
This adds auto-requests for
X_val,y_valandsample_weight_valinHistGradientBoostingClassifierandHistGradientBoostingRegressorand tests.AI usage disclosure
I used AI assistance for: