ENH Adds get_feature_names_out to neighbors module#22212
ENH Adds get_feature_names_out to neighbors module#22212thomasjpfan merged 15 commits intoscikit-learn:mainfrom
Conversation
Initial implementation of `get_feature_names_out`
|
Since both transformers map from a collection of feature vectors to a distance graph, the "output features" would just be the distance to each point of the fitted data right? This would be very verbose and potentially unwieldy for what I imagine the intended use of So the two obvious (not necessarily great) solutions to this I see are:
Part of me thinks the more "romantic" solution would be to have I'm leaning towards the first option (output features = columns of distance graph). |
|
For |
- Moved `_ClassNamePrefixFeaturesOutMixin` to specific transformers - Added `_ClassNamePrefixFeaturesOutMixin` to NCA - Added `self._n_features_out` to NCA
I guess my question is more-so: since the outputs of |
Yup, the number of feature names out must match the amount of output features from |
get_feature_names_out to neighbors moduleget_feature_names_out to neighbors module
ogrisel
left a comment
There was a problem hiding this comment.
https://github.com/scikit-learn/scikit-learn/pull/22212/files#r785147042 still needs to be addressed. Once done, I think this PR LGTM.
thomasjpfan
left a comment
There was a problem hiding this comment.
Thanks for the update @Micky774 !
We need tests to check the actual names of get_feature_names_out. See:
scikit-learn/sklearn/cross_decomposition/tests/test_pls.py
Lines 613 to 614 in 1d69784
|
Added in the unit tests! Thank you for all your active feedback, and for your patience in this. Let me know if there's anything else I should add here! |
ogrisel
left a comment
There was a problem hiding this comment.
I merged the main branch to resolve the conflict in the changelog. I also made this an enhancement instead of an API change because those features names method did not exist under a different name in the last released scikit-learn version.
One more code style detail, but otherwise, LGTM.
ogrisel
left a comment
There was a problem hiding this comment.
I wanted to approve this PR in previous review, instead of just commenting.
Co-authored-by: Olivier Grisel <[email protected]>
get_feature_names_out to neighbors module
Reference Issues/PRs
Addresses #21308
What does this implement/fix? Explain your changes.
Implements the
get_feature_names_outmethod to the neighbors moduleAny other comments?
This is a work in progress