scikit-learn/sklearn/feature_selection
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
..
tests ENH Allow `SelectFromModel`'s `max_features` to accept callables (#22356) 2022-03-22 11:18:12 +01:00
__init__.py MNT Applies black formatting to most of the code base (#18948) 2021-06-17 14:21:09 -04:00
_base.py MNT Remove utf-8 encoding declarations (#21260) 2022-03-14 17:59:36 +01:00
_from_model.py ENH Allow `SelectFromModel`'s `max_features` to accept callables (#22356) 2022-03-22 11:18:12 +01:00
_mutual_info.py MNT Drops Python 3.7 in CI, wheel building, and docs (#22617) 2022-02-28 18:23:02 +01:00
_rfe.py MNT Replace if_delegate_has_method with available_if in feature_selection (#20593) 2022-03-13 21:13:45 +01:00
_sequential.py DOC, MNT Typos found by codespell (#22906) 2022-03-20 19:16:39 +01:00
_univariate_selection.py DOC, MNT Typos found by codespell (#22906) 2022-03-20 19:16:39 +01:00
_variance_threshold.py DOC Adds missing imports into examples and test them (#21186) 2021-09-29 13:51:33 +02:00