Skip to content

ENH Expose verbose_feature_names_out in make_union#30406

Merged
OmarManzoor merged 6 commits intoscikit-learn:mainfrom
Ethan0456:feat/expose-verbose-feature-names-out-in-make-union
Jan 13, 2025
Merged

ENH Expose verbose_feature_names_out in make_union#30406
OmarManzoor merged 6 commits intoscikit-learn:mainfrom
Ethan0456:feat/expose-verbose-feature-names-out-in-make-union

Conversation

@Ethan0456
Copy link
Copy Markdown
Contributor

Reference Issues/PRs

Fixes #30364

What does this implement/fix? Explain your changes.

This PR exposes the verbose_feature_names_out argument in the make_union function. It allows users to control feature name uniqueness in the FeatureUnion by enabling or disabling automatic name prefixing, which helps in managing feature name collisions more effectively.

Any other comments?

No additional comments.

Signed-off-by: Abhijeetsingh Meena <abhijeet040403@gmail.com>
@github-actions
Copy link
Copy Markdown

github-actions bot commented Dec 4, 2024

✔️ Linting Passed

All linting checks passed. Your pull request is in excellent shape! ☀️

Generated for commit: 708a87b. Link to the linter CI: here

Signed-off-by: Abhijeetsingh Meena <abhijeet040403@gmail.com>
Copy link
Copy Markdown
Member

@thomasjpfan thomasjpfan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the PR @Ethan0456 !

  • Can you add a test to sklearn/tests/test_pipeline.py?
  • Also add a whats new in doc/whats_new/upcoming_changes/sklearn.pipeline/30406.enhancement.rst. You can follow the pattern that directory to see how to create new entry.

…t in make_union

- Added a test case to validate the `verbose_feature_names_out` argument in `make_union`, including handling of duplicate feature names.
- Added an enhancement entry in `doc/whats_new/upcoming_changes/sklearn.pipeline/30406.enhancement.rst`.

References scikit-learn#30364

Signed-off-by: Abhijeetsingh Meena <abhijeet040403@gmail.com>
Signed-off-by: Abhijeetsingh Meena <abhijeet040403@gmail.com>
Comment thread sklearn/tests/test_pipeline.py Outdated
return mock


def test_make_union_verbose_feature_names_out_enabled():
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since, we already have similar test for FeatureUnion. I think it's enough to test that make_union sets verbose_feature_names_out correctly. Something like this:

def test_make_union_passes_verbose_feature_names_out():
    union = make_union(..., verbose_feature_names_out=False)
    assert not union.verbose_feature_names_out

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @thomasjpfan,

I've simplified the test case in my recent commit. Could you please review it when you get a chance?

Thanks!

Signed-off-by: Abhijeetsingh Meena <abhijeet040403@gmail.com>
Copy link
Copy Markdown
Member

@thomasjpfan thomasjpfan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@thomasjpfan thomasjpfan added the Waiting for Second Reviewer First reviewer is done, need a second one! label Dec 15, 2024
@thomasjpfan thomasjpfan added the Quick Review For PRs that are quick to review label Dec 29, 2024
Copy link
Copy Markdown
Contributor

@OmarManzoor OmarManzoor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR @Ethan0456

Comment thread sklearn/tests/test_pipeline.py
@OmarManzoor OmarManzoor removed the Waiting for Second Reviewer First reviewer is done, need a second one! label Dec 30, 2024
Copy link
Copy Markdown
Contributor

@OmarManzoor OmarManzoor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks @Ethan0456

@OmarManzoor OmarManzoor merged commit b5047ac into scikit-learn:main Jan 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

module:pipeline Quick Review For PRs that are quick to review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Expose verbose_feature_names_out in make_union

3 participants