-
-
Notifications
You must be signed in to change notification settings - Fork 25.9k
ENH FeatureUnion: Add verbose_feature_names_out parameter #25991
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
Conversation
Add |
@thomasjpfan Mr.Fan. This PR right now has test cases covering all the new code and passes all the official tests and is ready to merge. You might be interested in taking a look at it :) |
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.
Although the implementation is not very DRY because it is a copy of ColumnTransformer
, I am okay with it. I do not see a great home to refactor the code right now. Another reviewer may feel different about this.
I left some comments on ways to simplify the tests.
Thank you so much for the suggestion! I will modify based on this |
Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>
Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>
Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>
Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>
Dear Mr.Fan, I have removed the previous version of the complex version that construct a column transformer and all switched to using pandas to 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.
LGTM! I am okay with repeating code here from ColumnTransformer
. Let's see what a second reviewer thinks.
Thanks Mr.Fan! |
Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>
Reference Issues/PRs
Fixes #25889.
What does this implement/fix? Explain your changes.
To have a
verbose_feature_names_out
attribute in FeatureUnion.If True,
get_feature_names_out
will prefix all feature names with the name of the transformer that generated that feature. If False,get_feature_names_out
will not prefix any feature names and will error if feature names are not unique.verbose_feature_names_out
attribute to classFeatureUnion
get_feature_names_out
to not add prefix automatically_add_prefix_for_feature_names_out
to add prefix whenverbose_feature_names_out
is True and check that names are all unique without a prefix if Falsetest_feature_union_passthrough_get_feature_names_out_false
to check for feature_names_out for verbose_feature_names_out=False_add_prefix_for_feature_names_out
functionAny other comments?