-
-
Notifications
You must be signed in to change notification settings - Fork 25.8k
ENH Adds n_features_in_ to ensemble module #19326
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
ENH Adds n_features_in_ to ensemble module #19326
Conversation
Can someone help me out with the CI error? |
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.
Minor comment, otherwise LGTM!
@@ -73,8 +73,9 @@ def __init__(self, | |||
self.random_state = random_state | |||
|
|||
def _check_X(self, X): | |||
return check_array(X, accept_sparse=['csr', 'csc'], ensure_2d=True, | |||
allow_nd=True, dtype=None) | |||
return self._validate_data( |
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.
I had to double check that _check_X
was only called during non-fit
methods. I think leaving a comment here would be best for now.
def _check_X(self, X):
# Only called to validate `X` in non-`fit` methods.
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.
LGTM apart of the single nitpick
@@ -2421,7 +2449,7 @@ def fit_transform(self, X, y=None, sample_weight=None): | |||
X_transformed : sparse matrix of shape (n_samples, n_out) | |||
Transformed dataset. | |||
""" | |||
X = check_array(X, accept_sparse=['csc']) | |||
X = self._validate_data(X, accept_sparse=['csc']) |
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.
Uhm what is the reason that the common test where not failing for this transformer since we did not introduce _validate_data
before
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.
test_check_n_features_in_after_fitting
is applied to all estimators except those from modules listed in N_FEATURES_IN_AFTER_FIT_MODULES_TO_IGNORE
. Every module where we add n_features_in_
has to be removed from that list. This is done in this PR form ensemble.
Or do you think of another test?
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.
I was thinking about check_n_features_in(name, estimator_orig)
but I can check on the side.
Sorry we merged a new PR that added some conflicts in test_bagging
again.
@glemaitre Thanks for merging main. I had not seen merge conflicts here on github. |
Reference Issues/PRs
Continues #18514 and #19333.