-
-
Notifications
You must be signed in to change notification settings - Fork 25.8k
ENH Add get_feature_names_out for ensemble module #21459
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 Add get_feature_names_out for ensemble module #21459
Conversation
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.
Here is a way to help you fix the broken CI but I think we should directly reuse _ClassNamePrefixFeaturesOutMixin
for this module. See comments below for details:
sklearn/ensemble/_forest.py
Outdated
return np.asarray( | ||
[f"{class_name}{i}" for i in range(self.n_outputs_)], | ||
dtype=object, | ||
) |
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.
Alternatively, you could merge the current main
into this branch to reuse the _ClassNamePrefixFeaturesOutMixin
mixin-class introduced in https://github.com/scikit-learn/scikit-learn/pull/21334/files#diff-ac9c452d8c660d2516089c8448596912c22417c7c690f079715593e61ef6ee0dR884
This would require you to set the private _n_features_out
attribute at fit time.
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.
Hi @ogrisel , I've changed all of the classes to use _ClassNamePrefixFeaturesOutMixin
as you suggested
@MaxwellLZH it seems that you have added a bunch of unwanted changes to this branch when merging |
This reverts commit 879ebd0.
This branch is still in an inconsistent state. Maybe start over in a new branch branched off of a recently updated |
closed. Reopen a new PR. |
Reference Issues/PRs
Part of #21308
What does this implement/fix? Explain your changes.
Implementing
get_feature_names_out
forRandomForestEmbedding
,VotingClassifier
,VotingRegressor
,StackingClassifier
andStackingRegressor
, with corresponding test cases.