[MRG] Pass sample_weight when predicting on stacked folds#16539
[MRG] Pass sample_weight when predicting on stacked folds#16539thomasjpfan merged 22 commits intoscikit-learn:masterfrom
Conversation
jnothman
left a comment
There was a problem hiding this comment.
Please add a |Fix| entry to the change log at doc/whats_new/v0.23.rst. Like the other entries there, please reference this pull request with :pr: and credit yourself (and other contributors if applicable) with :user:
Please add a versionchanged note in the docstring of sample_weight
|
But tests are failing. Should have checked that first |
@jnothman : Thank you for the prompt review. I've added the requested doc changes and fixed the failing specs. Please let me know if you'd like more details in the versionchange/release notes or if you'd like to see more tests. |
glemaitre
left a comment
There was a problem hiding this comment.
This looks good. Only a couple of comments
…kingRegressor instead of _BaseStacking
|
@glemaitre Thank you for the comments. I updated the release notes to reference I also created a follow-on issue (#16595) regarding the naming of Please take another look at these changes and let me know if there is anything else you'd like me to include. |
sklearn/utils/_mocking.py
Outdated
| assert self.check_X(X) | ||
| if self.check_y is not None: | ||
| assert self.check_y(y) | ||
| self._check_n_features(X, reset=True) |
There was a problem hiding this comment.
I needed to add this call so that n_features_in_ is set correctly in CheckingClassifier.
The property is read during the fit method of BaseStacking: d205638#diff-c8f397939f2393da5b2eef4285761da1R143. We use CheckingClassifier in the unit tests for the stacking estimators: https://github.com/scikit-learn/scikit-learn/pull/16539/files#diff-3979301645c7cbae79edc4085d997029R443
thomasjpfan
left a comment
There was a problem hiding this comment.
Thank you for the PR @wderose
LGTM!
Reference Issues/PRs
Fixes #16537.
What does this implement/fix? Explain your changes.
This PR passes
sample_weightviafit_paramswhen we callcross_val_predictin_BaseStacking, as per the comment here.scikit-learn/sklearn/ensemble/_stacking.py
Lines 169 to 175 in 136ef79
Any other comments?
cc: @caioaao @glemaitre