Skip to content

ENH Add get_feature_names_out for random_projection module#21330

Merged
ogrisel merged 5 commits intoscikit-learn:mainfrom
lesteve:get-feature-names-random-projection
Nov 3, 2021
Merged

ENH Add get_feature_names_out for random_projection module#21330
ogrisel merged 5 commits intoscikit-learn:mainfrom
lesteve:get-feature-names-random-projection

Conversation

@lesteve
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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