Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

FIX Backwards SequentialFeatureSelector always drops one feature #26480

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

Draft
wants to merge 4 commits into
base: main
Choose a base branch
Loading
from

Conversation

betatim
Copy link
Member

@betatim betatim commented Jun 1, 2023

Reference Issues/PRs

Closes #26369

What does this implement/fix? Explain your changes.

This is an attempt at closing the issue. It uses the "all features selected" cross val score as the starting value instead of -inf for backwards selection. I also changed the forward selection starting value to 0, I think scores have to be between zero and one?!

I also had to update the tests after this change, so I am not sure the changes are correct. (Maybe the test was wrong, but maybe not?)

This is just a draft/way to store this work in progress somewhere and lets others see it. Maybe someone wants to take on this PR.

Any other comments?

There is code to reproduce the problem in the original issue. It could be a good starting point for making a non-regression test.

@@ -64,7 +65,7 @@ def test_n_features_to_select_auto(direction):
)
sfs.fit(X, y)

max_features_to_select = n_features - 1
# max_features_to_select = n_features - 1
Copy link
Member Author

Choose a reason for hiding this comment

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

I don't understand why this was here in the first place :-/

@betatim betatim force-pushed the feature-selection-fix branch from 0f00fb7 to 0d8b8b5 Compare June 6, 2023 13:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SequentialFeatureSelector in backward auto mode will always remove one feature
1 participant
Morty Proxy This is a proxified and sanitized view of the page, visit original site.