Thanks to visit codestin.com
Credit goes to github.com

Skip to content

ENH preserves dtypes for GenericUnivariateSelect class - #22370

Merged
jeremiedbb merged 18 commits into
scikit-learn:mainfrom
Micky774:feature_dtype
Feb 14, 2022
Merged

ENH preserves dtypes for GenericUnivariateSelect class#22370
jeremiedbb merged 18 commits into
scikit-learn:mainfrom
Micky774:feature_dtype

Conversation

@Micky774

@Micky774 Micky774 commented Feb 4, 2022

Copy link
Copy Markdown
Contributor

Reference Issues/PRs
Addresses #11000
Picks up stalled PR #18482

What does this implement/fix? Explain your changes.
PR #18482: Preserves dtypes for GenericUnivariateSelect class.
This PR: Picks up stall and merges main

Any other comments?

@Micky774

Micky774 commented Feb 4, 2022

Copy link
Copy Markdown
Contributor Author

@rth @cmarmo

Re: "...we need to investigate why test_estimators[GenericUnivariateSelect()-check_dtype_object(strict_mode=True)] is failing"
After looking into it for a bit, it seems that the GUS performs checks on its X, y data explicitly through the _check_params method of the chosen selector and implicitly in the passed score function. In this case, functions like chi2 successfully check against the object case, but evidently f_regression -- or more precisely, r_regression -- doesn't.

Given that r_regression makes sense when called with a potentially-numeric object-type y, I think it would be reasonable to just set y_numeric=True in

X, y = check_X_y(X, y, accept_sparse=["csr", "csc", "coo"], dtype=np.float64)

@thomasjpfan thomasjpfan 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.

Thanks for the PR!

Comment thread sklearn/utils/estimator_checks.py Outdated
Comment thread sklearn/feature_selection/_base.py
Comment thread doc/whats_new/v1.1.rst Outdated

@thomasjpfan thomasjpfan 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.

Looking good.

Comment thread sklearn/feature_selection/tests/test_feature_select.py Outdated
Comment thread sklearn/utils/estimator_checks.py Outdated
Comment thread doc/whats_new/v1.1.rst Outdated
Comment thread sklearn/utils/estimator_checks.py Outdated

@thomasjpfan thomasjpfan 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.

Thanks for the update! LGTM

@thomasjpfan thomasjpfan added the Quick Review For PRs that are quick to review label Feb 12, 2022

@jeremiedbb jeremiedbb 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.

LGTM. Thanks @Micky774 !

@jeremiedbb
jeremiedbb merged commit e821a9e into scikit-learn:main Feb 14, 2022
thomasjpfan added a commit to thomasjpfan/scikit-learn that referenced this pull request Mar 1, 2022
…22370)

Co-authored-by: Thierry Gameiro <[email protected]>
Co-authored-by: titigmr <[email protected]>
Co-authored-by: Thomas J. Fan <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants