Skip to content

FEA add SelectThreshold to filter features based on a user-specified score function - #27722

Open
glemaitre wants to merge 7 commits into
scikit-learn:mainfrom
glemaitre:selectthreshold
Open

glemaitre wants to merge 7 commits into
scikit-learn:mainfrom
glemaitre:selectthreshold

Conversation

@glemaitre

@glemaitre glemaitre commented Nov 4, 2023 •

Copy link
Copy Markdown
Member

Depends on #27721
closes #27609
closes #21699

Add SelectThreshold that is a filter selecting features that have a higher score than a user-defined threshold.

This selector allows for similar use case to VarianceThreshold but has more flexibility since the score function is not limited to the variance.

@glemaitre
glemaitre marked this pull request as draft November 4, 2023 15:15
@glemaitre glemaitre changed the title FEA add SelectThreshold to filter score based on user-specified thres… …hold FEA add SelectThreshold to filter score based on user-specified threshold Nov 4, 2023
@github-actions

github-actions Bot commented Nov 4, 2023 •

Copy link
Copy Markdown

✔️ Linting Passed

All linting checks passed. Your pull request is in excellent shape! ☀️

Generated for commit: 513ceea. Link to the linter CI: here

@glemaitre

Copy link
Copy Markdown
Member Author

Putting this PR since we need to merge #27721 first.

@glemaitre
glemaitre marked this pull request as ready for review December 4, 2023 14:00
@glemaitre

Copy link
Copy Markdown
Member Author

Subsequent PR to #27721. @thomasjpfan @OmarManzoor @lorentzenchr if you want to give a look.

@adrinjalali adrinjalali left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Overall it looks good, but I notice we don't have good citations in the user guide or in the API docs, and there's the issue with p-values.

Comment thread doc/whats_new/v1.4.rst
Comment on lines +416 to +417
that have a higher score than the `threshold` parameter. This filter works in an
unsupervised setting and is available as a mode in

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

it can be unsupervised, but by default it's supervised.

@ogrisel ogrisel Feb 26, 2025 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I agree this changelog entry is really misleading and should be rewritten to describe the nominal use case (that is, the supervised case).

Comment on lines +1018 to +1019
pvalues_ : array-like of shape (n_features,)
p-values of feature scores, None if `score_func` returned only scores.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

it makes me cringe that we're reporting p-values here 😁 and that there's no comment on whether they're corrected or not, and how they should be corrected if not, before being potentially used.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If we require the score_func to compute p-values, it's weird to threshold on the score values (that is the value of the test statistic, which can vary on an arbitrary scale) instead of the p-values.

@ogrisel ogrisel changed the title FEA add SelectThreshold to filter score based on user-specified threshold FEA add SelectThreshold to filter features based on a user-specified score function Feb 26, 2025

@ogrisel ogrisel left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The name SelectThreshold is confusing. This does not "select a threshold".

Instead, I would suggest SelectByScore or SelectAboveScoreThreshold or SelectAboveScore.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

3 participants