Skip to content

ENH Add get_feature_names_out for random_projection module #21330

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

Merged

Conversation

lesteve
Copy link
Member

@lesteve lesteve commented Oct 14, 2021

Reference Issues/PRs

Part of #21308.

What does this implement/fix? Explain your changes.

Adds get_feature_names_out to the random_projection module.

Any other comments?

When #21079 gets merged, I could use generate_names=False in _check_feature_names_in (see https://github.com/scikit-learn/scikit-learn/pull/21079/files#diff-962bea3f949b0a1e7b2ad40d2879f5d7ba1e6cd7da168daa82f84a87e800715e for more details) since the names of the output features don't reuse the names of the input features.

Copy link
Member

@TomDLT TomDLT left a comment

Choose a reason for hiding this comment

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

LGTM. We might wait for #21079 to be merged, to both remember to use generate_names=False and to add this PR in the changelog entry.

Copy link
Member

@ogrisel ogrisel left a comment

Choose a reason for hiding this comment

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

Same opinion as @TomDLT.

@lesteve lesteve force-pushed the get-feature-names-random-projection branch from 144e1c0 to e5766ef Compare November 2, 2021 13:51
@@ -24,7 +24,7 @@

all_SparseRandomProjection: List[Any] = [SparseRandomProjection]
all_DenseRandomProjection: List[Any] = [GaussianRandomProjection]
all_RandomProjection = set(all_SparseRandomProjection + all_DenseRandomProjection)
all_RandomProjection = all_SparseRandomProjection + all_DenseRandomProjection
Copy link
Member Author

@lesteve lesteve Nov 2, 2021

Choose a reason for hiding this comment

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

This was done to avoid a pytest-xdist error about workers collecting different tests (different order).

It does not seem that crucial that all_RandomProjection is a set in this file.

Copy link
Member

@ogrisel ogrisel left a comment

Choose a reason for hiding this comment

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

LGTM!

@ogrisel ogrisel merged commit b07b227 into scikit-learn:main Nov 3, 2021
@ogrisel
Copy link
Member

ogrisel commented Nov 3, 2021

Merged! Thanks @lesteve.

@lesteve lesteve deleted the get-feature-names-random-projection branch November 3, 2021 16:37
glemaitre pushed a commit to glemaitre/scikit-learn that referenced this pull request Nov 29, 2021
samronsin pushed a commit to samronsin/scikit-learn that referenced this pull request Nov 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants