Commit Graph

248 Commits

Author SHA1 Message Date
Guillaume Lemaitre 2d9f4c4420
ENH support unsupervised feature selection for percentile and k-best (#27721) 2023-12-04 10:19:21 +00:00
Thomas J. Fan 7d5428def5
ENH Warn in SelectKBest when k > n_features (#27841) 2023-12-01 09:06:42 +01:00
Thomas J. Fan 3ff6c82d50
FIX Adjust tags in RFE to allow nans by default (#21807)
Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>
2023-10-20 15:22:42 +00:00
Yao Xiao f2b5a2d9d4
TST Extend tests for `scipy.sparse/*array` in `sklearn/feature_selection/tests/test_variance_threshold` (#27222) 2023-09-13 15:11:55 +02:00
Tialo f54212f7ce
TST Extend tests for `scipy.sparse.*array` in `sklearn/feature_selection/tests/test_feature_select.py` (#27239)
Co-authored-by: Guillaume Lemaitre <g.lemaitre58@gmail.com>
Co-authored-by: Omar Salman <omar.salman@arbisoft.com>
2023-09-13 12:50:53 +00:00
Mohit Joshi af6c35d26e
TST Extend tests for `scipy.sparse.*array` in `sklearn/feature_selection/tests/test_sequential.py` (#27178) 2023-09-11 11:47:58 +02:00
Mohit Joshi 8eef53fa1d
TST Extend tests for `scipy.sparse.*array` in `sklearn/feature_selection/tests/test_rfe.py` (#27177) 2023-09-11 11:34:42 +02:00
Mohit Joshi 11cf0eec3e
TST Extend tests for `scipy.sparse.*array` in `sklearn/feature_selection/tests/test_chi2.py` (#27176)
Co-authored-by: Omar Salman <omar.salman@arbisoft.com>
2023-09-11 11:33:32 +02:00
Mohit Joshi c366f93394
TST Extend tests for `scipy.sparse.*array` in `sklearn/feature_selection/tests/test_base.py` (#27175) 2023-09-11 11:32:44 +02:00
Brendan Lu 8d48624ec9
TST Extend tests for `scipy.sparse.*array` in `sklearn/feature_selection/tests/test_mutual_info.py` (#27173)
Co-authored-by: Guillaume Lemaitre <g.lemaitre58@gmail.com>
2023-09-11 11:31:21 +02:00
Yao Xiao 14995509a9
FIX `mutual_info_regression` when `X` is of integer dtype (#26748) 2023-07-03 17:35:12 -04:00
Adrin Jalali 42173fdb34
MNT add isort to ruff's rules (#26649) 2023-06-21 17:50:07 +02:00
Jérémie du Boisberranger 97bab0e5b3
MAINT Change default value of n_features_to_select for 1.3 (#26475) 2023-06-01 09:45:48 +02:00
Gleb Levitski b32e5c7ab3
ENH Accept 'auto' option for 'dual' parameter in LinearSVC and LinearSVR (#26093) 2023-05-30 16:54:24 +02:00
Yao Xiao ec8a2a63b3
FIX SequentialFeatureSelector throws IndexError when cv is a generator (#25973) 2023-03-28 21:11:35 +00:00
Ralf Gommers d926ff130f
MAINT remove np.product and inf/nan aliases in favor of canonical names (#25741) 2023-03-02 10:52:07 +01:00
Jérémie du Boisberranger 7b595569b2
FIX Allow negative tol in SequentialFeatureSelector (#25664) 2023-02-24 13:39:47 +01:00
Thomas J. Fan 677a4cfef6
ENH Preserve DataFrame dtypes in transform for feature selectors (#25102) 2023-02-19 19:25:29 +01:00
John Pangas bd1d165789
ENH Raise NotFittedError in get_feature_names_out for estimators that use ClassNamePrefixFeatureOutMixin and SelectorMixin (#25308)
Co-authored-by: Guillaume Lemaitre <g.lemaitre58@gmail.com>
2023-01-24 09:54:43 -05:00
Guillaume Lemaitre 86301acc28
FIX always scale continuous features to unit variance in mutual info (#24747)
Co-authored-by: Tim Head <betatim@gmail.com>
Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>
Co-authored-by: jeremie du boisberranger <jeremiedbb@yahoo.fr>
2022-11-16 17:19:30 +01:00
Guillaume Lemaitre b2edcdc5e4
FIX accept param='all' in GenericUnivariateSelect (#24950) 2022-11-16 11:59:02 +01:00
Jérémie du Boisberranger bfecfe97fd
MAINT Clean deprecation for 1.2: grid_scores_ in RFECV (#24404) 2022-09-27 15:51:58 +02:00
Claudio Salvatore Arcidiacono 4352b7c563
TST add global random seed to sklearn/feature_selection/tests/test_rfe.py (#24142)
Co-authored-by: Meekail Zain <34613774+Micky774@users.noreply.github.com>
Co-authored-by: jeremiedbb <jeremiedbb@yahoo.fr>
2022-09-25 18:02:36 +02:00
Jérémie du Boisberranger 1a6f9b6414
TST Remove remaining tests now covered by common param validation test (#24383) 2022-09-07 14:50:31 +02:00
Stefanie Molin cf6c122cc1
MAINT Add parameter validation to `SelectFromModel` (#24213)
Co-authored-by: jeremie du boisberranger <jeremiedbb@yahoo.fr>
2022-09-02 10:47:58 +02:00
Stefanie Molin 8ec99040bc
MAINT Add parameter validation for classes in _univariate_selection.py (#24139)
Co-authored-by: Guillaume Lemaitre <g.lemaitre58@gmail.com>
Co-authored-by: jeremie du boisberranger <jeremiedbb@yahoo.fr>
2022-08-30 16:40:31 +02:00
Stefanie Molin c9d4e1f86e
MAINT Add parameter validation to RFE and RFECV. (#24137)
Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>
2022-08-29 16:49:10 -04:00
Stefanie Molin 856d469bb9
MAINT Add parameter validation to SequentialFeatureSelector. (#24129)
Co-authored-by: Guillaume Lemaitre <g.lemaitre58@gmail.com>
Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>
2022-08-29 09:35:39 -04:00
Hao Chun Chang 8ff2c83b89
FIX Add ElasticNet* and LassoCV checks in feature_selection._from_model threshold (#23636)
Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>
2022-07-19 14:11:47 -04:00
Sangam b60832dfd0
MAINT validate parameter in VarianceThreshold (#23581)
Co-authored-by: Sangam Swadi K <sangamswadik@users.noreply.github.com>
Co-authored-by: Jérémie du Boisberranger <34657725+jeremiedbb@users.noreply.github.com>
2022-06-24 17:53:58 +02:00
SELEE eace47aea7
FIX partial_fit from SelectFromModel doesn't validate the parameters (#23299)
Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>
Co-authored-by: Guillaume Lemaitre <g.lemaitre58@gmail.com>
2022-05-11 11:53:43 +02:00
Guillaume Lemaitre 6bbb3cb45a
FIX params validation in SelectFromModel with prefit=True (#23271)
Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>
Co-authored-by: Jérémie du Boisberranger <34657725+jeremiedbb@users.noreply.github.com>
2022-05-04 17:57:50 +02:00
iasoon d1f6458d0d
TST Replace pytest.warns(None) in test_from_model.py (#23055) 2022-04-06 13:31:53 -04:00
iasoon 087c7e2f2c
TST Replace pytest.warns(None) in test_feature_select (#23041) 2022-04-04 15:11:22 +02:00
Guillaume Lemaitre 8cdeb8010c
FIX make coef_ in PLS estimator consistent with linear models (#22016)
Co-authored-by: jeremie du boisberranger <jeremiedbb@yahoo.fr>
Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>
2022-03-28 17:27:21 +02:00
Julien Jerphanion e7d718ccf2
TST use global_dtype in feature_selection/tests/test_mutual_info.py (#22677)
Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>
Co-authored-by: Jérémie du Boisberranger <jeremiedbb@users.noreply.github.com>
2022-03-25 18:06:09 +01:00
Meekail Zain db24a30bd3
ENH Allow `SelectFromModel`'s `max_features` to accept callables (#22356)
* Initial implementation

* Improved error handling and stability

* Added unit tests

* Updated test to use `max_features_` instead of `max_features`

* Added documentation for new private attribute `max_features_`

* Improved error handling for callables

* Updated whats_new

* Removed incorrect term reference to `max_features`

* Removed float case and improved testing

* Updated test names to more clearly reflect intention

* Added a sample callable in `max_features` description

* Improved documentation and streamlined error handling

* Updated example to include demonstrate using a callable for max_features

* Separated out callable demo into separate example

* Removed demo from `max_features` docs (now in example)

* Updated changelog

* Apply suggestions from code review

Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>

* Trimmed unneeded comments

* Updated tests to reflect new error handling

* Removed new line at end of docstring

* Updated docstring

* Fixed example syntax error

* Fixed example syntax

* Apply suggestions from code review

Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>

* Reverted irrelevant changes

* Update sklearn/feature_selection/_from_model.py

Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>

* Fixed error message

* Improved test coverage

* Minor doc improvement -- added a list for `max_features` type

* Update sklearn/feature_selection/_from_model.py

Co-authored-by: Adrin Jalali <adrin.jalali@gmail.com>

* Improved input validation and added test for array-like

* Updated doc to use no longer use lambda function

* Fixed docstring list

* Added missing whitespace for list format in docstring

Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>
Co-authored-by: Adrin Jalali <adrin.jalali@gmail.com>
2022-03-22 11:18:12 +01:00
Julien Jerphanion 613773db11
TST Add minimal setup to be able to run test suite on float32 (#22690)
Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>
Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>
Co-authored-by: Jérémie du Boisberranger <jeremiedbb@users.noreply.github.com>
2022-03-17 14:25:17 +01:00
Thomas J. Fan 1fc86b6aac
MNT Update black to stable version (#22474) 2022-02-15 11:36:26 +01:00
Meekail Zain e821a9e8a0
ENH preserves dtypes for GenericUnivariateSelect class (#22370)
Co-authored-by: Thierry Gameiro <titigmr@MacBook-Air-de-Thierry.local>
Co-authored-by: titigmr <thierry.gmr@outlook.fr>
Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>
2022-02-14 18:24:29 +01:00
Thomas J. Fan 9f85c9d449
TST Better info when checking for no warnings in tests (#22362) 2022-02-03 11:42:48 +01:00
murata-yu 30360ee997
ENH Adds n_features_to_select upper limit to SeqFeatureSelector (#20145)
Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>
Co-authored-by: Nicolas Hug <contact@nicolas-hug.com>
Co-authored-by: Guillaume Lemaitre <g.lemaitre58@gmail.com>
Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>
Co-authored-by: bmreiniger <40676050+bmreiniger@users.noreply.github.com>
2021-12-24 09:13:16 -05:00
Thomas J. Fan 6db0e2cd5f
FIX Improves feature names support for SelectFromModel + Est w/o names (#21991)
Co-authored-by: Guillaume Lemaitre <g.lemaitre58@gmail.com>
2021-12-24 14:16:25 +01:00
Maxwell 3766232448
ENH speed up test_unsupervised_model_fit (#22045)
Co-authored-by: Guillaume Lemaitre <g.lemaitre58@gmail.com>
2021-12-22 23:57:17 -05:00
Juan Carlos Alfaro Jiménez 7de08f5ced
ENH add a parameter force_finite to r_regression and f_regression (#17819)
Co-authored-by: Julien Jerphanion <git@jjerphan.xyz>
Co-authored-by: Guillaume Lemaitre <g.lemaitre58@gmail.com>
2021-12-20 08:40:09 +01:00
Jorge Loayza 3f8868072c
reduced n_samples and n_features in test_nan_support for faster pytest (#21823) 2021-12-02 21:13:23 +01:00
Olivier Grisel 2571cb2989
Improve validation messages with infinite data (#21219)
* Improve validation messages with infinite data

* Extend and fix validation tests

* Test and fix extended error message

* data_name => input_name

* Mention estimators that natively support missing values

* More informative error message

* cosmetic

* typo

* Fix broken tests

* Fix test_knn

* Add changelog entry

* Fix broken test for param search models

* Missing input names

* Allow Y and y in estimator checks

* Add missing input names

* Fix input_name for FunctionTransformer

* More missing input names

* Update test

* More test fixes on scores

* Simplify message to avoid to make generic fallback meaningful

Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>

* More informative estimator checks failure messages

* Make sure the estimator name is passed correctly in _validate_data

* Simplify calls to _validate_data

* Handle estimator name in private _check_y helper

* More specific error message

* Add estimator to check_X_params and check_y_params

* Add .. versionadded flags in public docstrings

* Update changelog

* Improve _validate_data's docstring

* Typo in doc/whats_new/v1.1.rst

* Make _check_estimator_name return None if estimator == None

Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>

* check_params dict updates with style

* Increase test coverage

Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>
2021-10-29 15:59:57 +02:00
Shuhei Kayawari daec880bff
API Replacing grid_scores_ by cv_results_ in _rfe.py and test_rfe.py (#20161)
Co-authored-by: arka204 <kmichalik204@gmail.com>
Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>
Co-authored-by: Guillaume Lemaitre <g.lemaitre58@gmail.com>
2021-07-30 18:01:49 +02:00
Shyam Desai acc13de65e
FIX make SFS compatible wiht unsupervised estimator having a score method (#19568)
Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>
Co-authored-by: Chiara Marmo <cmarmo@users.noreply.github.com>
Co-authored-by: Guillaume Lemaitre <g.lemaitre58@gmail.com>
2021-07-29 17:01:29 +02:00
Felipe Rodrigues eb901df93f
ENH Allow `sample_weight` and other `fit_params` in RFE (#20380)
Co-authored-by: Guillaume Lemaitre <g.lemaitre58@gmail.com>
Co-authored-by: Adrin Jalali <adrin.jalali@gmail.com>
2021-07-27 18:24:35 +02:00