Skip to content

fix backward feature selection for fixed_steps #34

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

johnrushwrs
Copy link

@johnrushwrs johnrushwrs commented Apr 13, 2025

Backward feature selection has some issues, namely:

  • n_terms is incorrect as it should be the num_available_features - n_steps
  • initial_state is incorrect as it should be the list of initial predictors in backward selection

@jonathan-taylor do you mind taking a review here? only tried to fix the fixed_steps case, but I imagine first_peak has the same issue as well.

Love the ISLP library and book by the way! I just found this issue while going through the exercises in chapter 6, 8.d was not possible to do with the current package. LMK if the fix looks good :)

@johnrushwrs johnrushwrs reopened this Apr 13, 2025
@johnrushwrs
Copy link
Author

Test output:

$ pytest -s  tests/models/test_selection.py::test_fixed_steps_backward
======================================================================= test session starts ========================================================================
platform darwin -- Python 3.12.7, pytest-7.4.4, pluggy-1.0.0
plugins: anyio-4.2.0
collected 1 item                                                                                                                                                   

tests/models/test_selection.py selected ['A', 'D', 'G']
selected ['A', 'B', 'C', 'E', 'G']
.

======================================================================== 1 passed in 1.66s =========================================================================

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.

1 participant