Commit Graph

495 Commits

Author SHA1 Message Date
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
Dimitri Papadopoulos Orfanos ee5a1b69d1
DOC, MNT Typos found by codespell (#22906) 2022-03-20 19:16:39 +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
Dimitri Papadopoulos Orfanos 3d4ee9e9dc
MNT Remove utf-8 encoding declarations (#21260)
Co-authored-by: Jérémie du Boisberranger <34657725+jeremiedbb@users.noreply.github.com>
2022-03-14 17:59:36 +01:00
Jack Liu f12987de98
MNT Replace if_delegate_has_method with available_if in feature_selection (#20593)
Co-authored-by: Guillaume Lemaitre <g.lemaitre58@gmail.com>
Co-authored-by: Jérémie du Boisberranger <34657725+jeremiedbb@users.noreply.github.com>
2022-03-13 21:13:45 +01:00
cdrig a8c41b55b8
fix docstring r-regression (#22785) 2022-03-12 16:41:44 +01:00
Olivier Grisel 279388d9ed
DOC Improve get_feature_names_out docstrings (#22718)
Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>
2022-03-07 13:02:12 -05:00
Jérémie du Boisberranger 33e4843e88
MNT remaining clean up for 1.1 (#22643) 2022-03-02 14:01:51 +01:00
Thomas J. Fan f1d3417b08
MNT Drops Python 3.7 in CI, wheel building, and docs (#22617)
* MNT Drops Python 3.7

* MNT Bump NumPy and SciPy

* FIX Fix build

* FIX Bump versions improved

* DOC Fixes numpy version [pypy]

* BLD [pypy] [icc-build]

* Update docs

* MAINT use scipy.optimize.LinearConstraint in test

* MAINT scipy 1.1.0 related code clean-up

* scipy>=1.3.2 in pyproject.toml's build deps

* [cd build]

* DOC Adds comment about pypy

* MAINT remove _astype_copy_false

* FIX Update check for python version in setup.py

Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>
2022-02-28 18:23:02 +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
Meekail Zain 254ea8c453
ENH Replaced RandomState with Generator compatible calls (#22271) 2022-01-28 15:49:34 -05:00
Meekail Zain b996234c4a
DOC Clarifies formula in f_regression's docstring (#22252)
Co-authored-by: ShamanthNyk <shammu1505@gmail.com>
Co-authored-by: Guillaume Lemaitre <g.lemaitre58@gmail.com>
2022-01-28 11:39:09 +01:00
Thomas J. Fan e1e8c66e05
ENH Improve efficiency of chi2 by converting the input to float first (#22235)
* ENH Improve efficiency of chi2 by converting the input to float first

* CLN Address comments

* Update sklearn/feature_selection/_univariate_selection.py

Co-authored-by: Julien Jerphanion <git@jjerphan.xyz>

Co-authored-by: Julien Jerphanion <git@jjerphan.xyz>
2022-01-21 08:05:55 +01:00
Louis Wagner 432778464c
[MRG] chi2: reduce memory footprint (#21837)
* added sparse_output=True to LabelBinarizer in chi2

* added changelog entry

* Update sklearn/feature_selection/_univariate_selection.py

Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>

* Update sklearn/feature_selection/_univariate_selection.py

Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>

Co-authored-by: Wagner, Louis <louis.wagner@cgm.com>
Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>
2022-01-20 22:44:16 +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
Thomas J. Fan 071f98f0a7
FIX Remove warnings when fitting a dataframe (#21578)
Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>
2021-11-29 17:55:37 +01:00
Sven Eschlbeck 2ead9dfffa
DOC Changed the description of the alpha param in SelectFpr class (#21684)
* Changed the description of the alpha param in SelectFpr class

* Update sklearn/feature_selection/_univariate_selection.py

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

Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>
2021-11-29 15:01:36 +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
Thomas J. Fan d1285a9232
DOC Adds missing imports into examples and test them (#21186) 2021-09-29 13:51:33 +02:00
genvalen 66f6fb3816
DOC Ensures that SequentialFeatureSelector passes numpydoc validation (#21035) 2021-09-14 10:11:25 +02:00
genvalen dd738a32cb
DOC Ensures that VarianceThreshold passes numpydoc validation (#21034) 2021-09-14 10:10:25 +02:00
Juan Martin Loyola 8bf222a016
DOC Ensures that SelectFromModel passes numpydoc validation (#20988)
Co-authored-by: Guillaume Lemaitre <g.lemaitre58@gmail.com>
2021-09-09 11:08:58 +02:00
Juan Martin Loyola e7027bd41e
DOC Ensures that SelectFwe passes numpydoc validation (#20986)
Co-authored-by: Guillaume Lemaitre <g.lemaitre58@gmail.com>
2021-09-09 11:07:36 +02:00
Juan Martin Loyola d6700558f0
DOC Ensures that SelectFpr passes numpydoc validation (#20985)
Co-authored-by: Guillaume Lemaitre <g.lemaitre58@gmail.com>
2021-09-09 11:06:52 +02:00
Juan Martin Loyola 58ed58d376
DOC Ensures that SelectFdr passes numpydoc validation (#20984) 2021-09-09 11:05:51 +02:00
Juan Martin Loyola 6568222fce
DOC Ensures that SelectKBest passes numpydoc validation (#20983) 2021-09-09 11:05:04 +02:00
Thomas J. Fan 4abd9f2d9e
API Implements get_feature_names_out for transformers that support get_feature_names (#18444)
Co-authored-by: Andreas Mueller <andreas.mueller@columbia.edu>
Co-authored-by: Andreas Mueller <andreasmuellerml@gmail.com>
Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>
Co-authored-by: Olivier Grisel <olivier.grisel@gmail.com>
Co-authored-by: Christian Lorentzen <lorentzen.ch@gmail.com>
2021-09-07 10:56:57 +02:00
Guillaume Lemaitre d6144caead DOC ensure that RFE is passing numpydoc validation 2021-08-31 19:14:37 +02:00
Juan Martin Loyola 1f2376144e
DOC Ensures that SelectPercentile passes numpydoc validation (#20824)
Co-authored-by: Guillaume Lemaitre <g.lemaitre58@gmail.com>
2021-08-31 16:19:16 +02:00
Thomas J. Fan 786c4e5e39
DOC Adds feature_names_in_ to docstrings (#20787) 2021-08-26 13:44:45 +02:00
Thomas J. Fan 416898b7f4
ENH Adds Column name consistency (#18010)
Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>
2021-08-17 14:48:21 +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
Mitzi bb28e82b3c
DOC Ensures that GenericUnivariateSelect passes numpydoc validation (#20495)
Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>
2021-07-11 14:47:58 +02:00
Jesse Lima aa1fca5bf3
DOC Ensures that RFECV passes numpydoc validation (#20452)
Co-authored-by: Guillaume Lemaitre <g.lemaitre58@gmail.com>
2021-07-07 10:44:57 +02:00
Jesse Lima e59a6c0a5a
DOC Ensures that RFE passes numpydoc validation (#20419)
Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>
2021-06-30 00:29:24 +02:00
Thomas J. Fan 3ae7c76153
STY Enables black with experimental_string_processing=true (#20412) 2021-06-29 09:47:04 +02:00
lacrosse91 555ade2e09
DOC Fix docstring summary line in _rfe.py (#20280)
Co-authored-by: Roman Yurchak <rth.yurchak@gmail.com>
2021-06-18 15:51:12 +02:00
Thomas J. Fan 351ace7935
STY Uses black's with target_version >= 3.7 (#20294) 2021-06-17 15:50:27 -04:00
Thomas J. Fan 82df48934e
MNT Applies black formatting to most of the code base (#18948) 2021-06-17 14:21:09 -04:00
Tomohiro Endo b5e5db4a43
API Raises an error when a negative threshold is chosen in VarianceThreshold (#20207) 2021-06-12 20:33:27 -04:00