Skip to content

Adding functionality to pass a list to initialize FPS, so that you ca… #116

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
merged 2 commits into from
Sep 9, 2021

Conversation

rosecers
Copy link
Collaborator

…n use previously fit values

This should hopefully be a small PR -- I've added the necessary tests and update docs.

The purpose of this PR is to allow someone to fit an FPS selector for n features / samples, then use the results of that selector to initialize a new selector that is choosing m features. Use case is "I chose 1000 features, but now I need 1001!"

@rosecers rosecers requested a review from Luthaf August 20, 2021 12:57
Copy link
Collaborator

@Luthaf Luthaf left a comment

Choose a reason for hiding this comment

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

Looks good overall!

with self.subTest(initialize=initialize):
selector = FPS(n_to_select=1, initialize=initialize)
selector = FPS(n_to_select=len(self.idx) - 1, initialize=initialize)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't understand the len(self.idx) - 1 here. Why not 1?

@@ -31,9 +31,9 @@ def test_initialize(self):
and throws an error otherwise
"""

for initialize in [self.idx[0], "random"]:
for initialize in [self.idx[0], "random", self.idx[:4]]:
Copy link
Collaborator

Choose a reason for hiding this comment

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

we should also have a test that restarting from a list gives back the indexes as the first selected values

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I pulled the test for the initialize list out of this loop to simplify things (remove the need for len(idx) - 1) and add the additional check that the lists are the same.

@rosecers rosecers requested a review from Luthaf August 20, 2021 14:24
@rosecers rosecers merged commit 896625c into main Sep 9, 2021
@rosecers rosecers deleted the feat/multi-initialize branch September 9, 2021 09:55
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.

2 participants