Commit Graph

235 Commits

Author SHA1 Message Date
Thomas J. Fan d4aad64b1e
MNT Update to black 22.3.0 to resolve click error (#22983)
* MNT Update to black 22.3.0 to resolve click error

* STY Update for new black version
2022-03-29 12:04:41 +02:00
Guillaume Lemaitre 229bd226ab
MNT remove _pairwise attribute (#21594) 2022-02-09 16:58:01 +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
Benjamin Bossan a3e0d4d79f
ENH make CalibratedClassifierCV accept on fit_params (#18170)
Co-authored-by: Julien Jerphanion <git@jjerphan.xyz>
Co-authored-by: BenjaminBossan <b.bossan@gmail.com>
Co-authored-by: Guillaume Lemaitre <g.lemaitre58@gmail.com>
2021-12-17 10:35:50 +01:00
MrinalTyagi 7774697ea5
FIX GridSearchCV and HalvingGridSearchCV remove validation from __init__ and set_params (#21880)
Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>
Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>
2021-12-15 11:34:22 +01:00
Megabyte 10bb3e290e
MNT modify test_nested_cv to speed-up CI build two (#21551)
Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>
2021-11-05 10:46:58 -04:00
Jérémie du Boisberranger a9bf7f38d7
FIX delete feature_names_in_ when refitting on a ndarray (#21389)
Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>
2021-10-23 12:30:05 +02:00
Loïc Estève 93bc20f7eb
Raise an error when all fits fail in cross-validation or grid-search (#21026) 2021-10-05 16:42:51 +02:00
Dimitri Papadopoulos Orfanos f71c031314
DOC Typos found by codespell (#21069) 2021-09-17 19:04:54 +02:00
t-jakubek d5215a1535
Fixing integer overflow on 32-bit architectures. (#20904)
Co-authored-by: Julien Jerphanion <git@jjerphan.xyz>
2021-09-03 14:00:26 +02:00
Guillaume Lemaitre cf2e4e3340
MNT replace if_delegate_has_method by available_if in _search.py (#20685)
* MNT replace if_delegate_has_method by available_if in _search.py

* iter

* iter

* apply changes from thomas

* iter

* fix

* iter
2021-09-01 11:50:16 +02:00
Loïc Estève 7317416193
Warn in the main process when a fit fails during a cross-validation (#20619)
Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>
Co-authored-by: Guillaume Lemaitre <g.lemaitre58@gmail.com>
Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>
2021-08-10 16:31:26 +02:00
Thomas J. Fan 3ae7c76153
STY Enables black with experimental_string_processing=true (#20412) 2021-06-29 09:47:04 +02:00
Thomas J. Fan 82df48934e
MNT Applies black formatting to most of the code base (#18948) 2021-06-17 14:21:09 -04:00
Guillaume Lemaitre 6484c4f0ec
TST add HalvingSearchCV to common test (#20203) 2021-06-15 18:16:50 +02:00
Tom Dupré la Tour f6e6ad2d9e
MNT clean futurewarning for 1.0 | _deprecate_positional_args (#20002)
Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>
Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>
2021-05-14 11:30:27 -04:00
Jérémie du Boisberranger 0f85e6b32f
MNT Clean deprecations for 1.0 | Search (#19321)
Co-authored-by: Olivier Grisel <olivier.grisel@gmail.com>
2021-05-11 16:41:36 -04:00
Nicolas Hug 872052b9ab
FIX convert cv_results_ values to numpy array in SuccessiveHalving (#19211)
Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>
2021-04-14 09:30:25 +02:00
xiaoyuchai f1018c6af1
FIX BaseSuccessiveHalving class groups support (#19847)
Co-authored-by: Shawn <shawn@mpirica.com>
Co-authored-by: Nicolas Hug <nicolashug@fb.com>
2021-04-12 07:54:31 +01:00
Nicolas Hug 309f135c32
MNT Remove HistGradientBoosting from experimental (#19799) 2021-04-02 16:40:20 +02:00
Rodion Martynov 0892a98fc9
Stratified Group KFold implementation (#18649)
* Initial implementation

* Forgot to add to second __add__ list

* Update split method parameter doc

* Added example; changed default test_size to 0.1; added to author list

* StratifiedGroupKFold impl and other improvements

* Add class to __all__ spec

* Remove random_state when no shuffle

* Tighter formatting

* Update the implementation of StratifiedGroupKFold

* Add StratifiedGroupKFold to __init__

* Add y checks to StartifiedGroupKFold

* Raise error if n_splits > max num samples in class

* Warn if n_splits > mn num samples in class

* Add SGKfold to general repr test

* Add SGKFold to 2d_y test case

* Add SGKfold to value erros test case

Parameters are the same as for StratifiedKFold
to ensure similar behavior given n_groups == n_samples

* Add SGKFold to StratifiedKFold test cases

The idea is to ensure similar behavior when groups are trivial
(n_groups == n_samples)

* Add SGKFold to reproducibility test case

* Add SGKFold to GroupKFold test case

* Add SGKFold to nested cv test case

* Add SGKFold to random_state with shuffle=False test case

* Add SGKFold to constant splits test case

* Fix repr test case

* Fix formatting issues

* Add samples to a fold with least num samples

Required to produce balanced size folds when the distribution of y is
more or less the same

* Remove GroupShuffleSplit impl

* Add notes to StratifiedGroupKFold

* Fix doctest

* Added stratified group kfold tests

* Better variable naming

* Add section to documentation

* Remove leftover StratifiedGroupShuffleSplit import

* Add changelist and reference to original kernel

* Better naming for least populated class check

* Better expression for number of labels

* Remove use of Counter

We already have this data in output of np.unique

* Add tests for homogeneous groups

* Add StratifiedGroupKFold test against GroupKFold

* Add changes to changelist in docstring

* Add StratifiedGroupKFold to classes.rst

* Fix description of StratifiedGroupKFold

* Move license notice out of docstring

* Disambiguate labels to classes in doc

* Add changelog entry

* Fix changelog author entry

* Fix StratifiedGroupKFold docstring

* Better variable names

* Remove defaultdict in favor of numpy indexing

* Extracted best_fold search into a separate method

* Make use of numpy broadcasting instead of for loop

* Encode groups and use arrays instead of dicts

* Use numpy sort instead of python

* Clarify shuffling behavior of StratifiedGroupKF in docs

* Switch name from label_idx to class_idx

* Remove accidentally leftover comment

* Fix np.sort keyword to support numpy < 1.15

* Fix typo in docstring

* Add StratifiedGroupKFold to visualization doc

* Add visualization for uneven group as an example

* Fix image numbers to match updated example

* Add author

* Add SGKF visualization to docs

* Add comments for groups in stratified CV tests

Co-authored-by: Leandro Hermida <hermidal@cs.umd.edu>
Co-authored-by: marrodion <rodion_martynov@epam.com>
2021-03-20 21:57:42 +11:00
Thomas J. Fan 6f180d79f5
BUG Fixes verbose > 2 for grid search (#19659) 2021-03-11 18:34:04 +01:00
Mohamed Haseeb ae3d955c90
TST Uses pytest.raises in model_selection/tests (#19621) 2021-03-09 11:45:57 -05:00
Mohamed Haseeb 5c0bbb0a4a
TST replaces assert_raise* by pytest.raises in model_selection (#19592)
Co-authored-by: Cycks <sikolia.wycliffe@gmail.com>
2021-03-02 12:14:26 +01:00
Mohamed Haseeb 72db93cc40
TST replaces assert_raises* by pytest.raises in model_selection/tests/test_split.py (#19585)
Co-authored-by: Cycks <sikolia.wycliffe@gmail.com>
2021-03-01 18:07:56 +01:00
Atsushi Nukariya b5e55f79fd
TST replace assert_warns* by pytest.warns in model_selection/tests (#19458) 2021-02-19 11:44:09 +01:00
Mohamed Haseeb a952fbb10e
MAINT Remove the use of assert_raises* in model_selection/tests/test_search (#19371) 2021-02-06 11:52:14 +01:00
Guillaume Lemaitre 2218ec4622
MNT change 0.25 to 1.0 and 0.26 to 1.1 in deprecation messages (#19005)
Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>
2020-12-18 16:09:19 +00:00
Guillaume Lemaitre 255718b4ad
introduce _safe_tags for estimator not inheriting from BaseEstimator (#18797)
Co-authored-by: Nicolas Hug <contact@nicolas-hug.com>
Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>
2020-12-02 11:18:53 +01:00
Amanda Dsouza 1e386a49fc
ENH Add support for 'fit_params' to learning_curve (#18595)
Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>
2020-10-14 12:25:58 -04:00
Amanda Dsouza 8091fafd70
[MRG] Fit params support for permutation_test_score and validation_curve (#18527) 2020-10-14 14:17:56 +02:00
Guillaume Lemaitre 7dcb1ac560
FIX allow to output error_score if a scoring failure happen (#18343)
Co-authored-by: Devi Sandeep Endluri <dsandeep97@tamu.edu>
Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>
2020-10-09 15:12:57 +02:00
Thomas J. Fan 3b334c5b25
MNT Uses enable_halving_search_cv instead (#18563) 2020-10-09 07:49:20 +11:00
Thomas J. Fan 02fa8f1adb
ENH Deprecates _pairwise attribute and adds pairwise to estimator tags (#18143) 2020-10-07 21:53:36 +11:00
Nicolas Hug 0a5af0d2a1
FEA Successive halving for faster parameter search (#13900)
* More flexible grid search interface

* added info dict parameter

* Put back removed test

* renamed info into more_results

* Passed grroups as well since we need n_to use get_n_splits(X, y, groups)

* port

* pep8

* dabl -> sklearn

* add _required_parameters

* skipping check in rst file if pandas not installed

* Update sklearn/model_selection/_search_successive_halving.py

Co-Authored-By: Joel Nothman <joel.nothman@gmail.com>

* renamed into GridHalvingSearchCV and RandomHalvingSearchCV

* Addressed thomas' comments

* repr

* removed passing group as a parameter to evaluate_candidates

* Joels comments

* pep8

* reorganized user user guide

* renaming

* update user guide

* remove groups support + pass fit_params

* parameter renaming

* pep8

* r_i -> resource_iter

* fixed r_i issues

* examples + removed use of word budget

* Added inpute checking tests

* added cv_resutlts_ user guide

* minor title change

* fixed doc layout

* Addressed some comments

* properly pass down fit_params

* change default value of force_exhaust_resources and update doc

* should fix doc

* Used check_fit_params

* Update section about min_resources and number of candidates

* Clarified ratio section

* Use ~ to refer to classes

* fixed doc checks

* Apply suggestions from code review

Co-authored-by: Joel Nothman <joel.nothman@gmail.com>

* Addressed easy comments from Joel

* missed some

* updated docstring of run_search

* Used f strings instead of format

* remove candidate duplication checks

* fix example

* Addressed easy comments

* rotate ticks labels

* Added discussion in the intro as suggested by Joel

* Split examples into sections

* minor changes

* remove force_exhaust_budget and introduce min_resources=exhaust

* some minor validation

* Added a n_resources_ attribute

* update examples

* Addressed comments

* passing CV instead of X,y

* minor revert for handling fit_params

* updated docs

* fix len

* whatsnew

* Add test for sampling when all_list

* minor change to top-k

* Force CV splits to be consistent across calls

* reorder parameters

* reduced diff

* added tests for top_k

* put back doc for groups

* not sure what went wrong

* put import at its place

* some comment

* Addressed comments

* Added tests for cv_results_ and base estimator inputs

* pep8

* avoid monkeypatching

* rename df

* use Joel's suggestions for testing masks

* Made it experimental

* Should fix docs

* whats new entry

* Apply suggestions from code review

Co-authored-by: Andreas Mueller <t3kcit@gmail.com>

* Addressed comments to docs

* Addressed comments in examples

* minor doc update

* minor renaming in UG

* forgot some

* some sad note about splitter statefulness :'(

* Addressed comments

* ratio -> factor

Co-authored-by: Joel Nothman <joel.nothman@gmail.com>
Co-authored-by: Andreas Mueller <t3kcit@gmail.com>
2020-09-09 17:12:35 +02:00
subrat93 192c2333fe
ENH Raises warning when getting non-finite score in SearchCV (#18266)
Co-authored-by: Guillaume Lemaitre <g.lemaitre58@gmail.com>
Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>
2020-08-29 10:34:02 -04:00
Nicolas Hug 28c1ed473f
[MRG] FIX len() of ParameterSampler (#18222)
* fix len

* whatsnew
2020-08-21 13:13:31 -04:00
Thomas J. Fan ad9cef3696
TST Uses regex for flaky test (#18209) 2020-08-21 08:03:08 +10:00
Thomas J. Fan 9acfaab966
ENH Adds support for multimetric callable return a dictionary (#15126) 2020-07-16 17:55:40 +02:00
Juan Carlos Alfaro Jiménez 9cd13a1fa1
FIX Change MRO for some estimators (#17837) 2020-07-05 13:52:42 +02:00
Juan Carlos Alfaro Jiménez 0e33229351
FIX Extract estimator objects before aggregating dict of scores (#17745)
Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>
2020-06-26 21:15:41 -04:00
Thomas J. Fan 67bf1e78f5
ENH _fit_and_score now returns a dictionary (#17332)
* ENH _fit_and_score now returns a dictionary

* MRG

* REV

* LOL

* Removing things in gitignore is fun
2020-06-26 12:38:12 +02:00
Thomas J. Fan 7cc0177f8e
MNT Replaces numpy alias with builtin typse (#17687)
* MNT Replaces numpy alias with builtin typse

* STY Lint error
2020-06-24 16:51:51 +02:00
Koki Nishihara e02e1bf7cb
FIX: Remove checks for old Scipy versions (#17685) 2020-06-24 10:02:15 +02:00
Chiara Marmo fc0d2c3210
[MRG] ENH Show split/candidate ids in verbose output of SearchCV (#16935) 2020-06-19 11:26:58 +02:00
Teon L Brooks 5d04910476
ENH add score_samples method in base search CV (#17478)
* add score_samples method in base search CV and add tests

* add tests and change implem

* fix pep8

* address some pr comments

* Update test_search.py

remove deprecation warnings

* address some linting issues

* Update test_search.py

* update whats_new

fix indenting

* update test_search.py

Co-authored-by: Mohamed Maskani <maskani.mohamed@gmail.com>
2020-06-08 18:14:12 +02:00
Benjamin Bossan 76df39f703
ENH allow to specify which methods should run a check in CheckingClassifier (#15230)
Co-authored-by: BenjaminBossan <b.bossan@gmail.com>
Co-authored-by: Guillaume Lemaitre <g.lemaitre58@gmail.com>
2020-05-26 11:37:12 +02:00
Nicolas Hug ac8cbb3799
[MRG] More deprecation for 0.24 (#17142)
* normalize_components in sparsePCA

* changed default strategy of Dummy to prior and removed outputs_2d ttribute

* removed usage of None to drop estimator in ensemble and behaviour param of IsolationForest

* remove support for drop=None in Voting

* removed some warning decorators

* remove feature_extraction.extract_patches

* removed VectorizerMixin and copy parameter from TFIDFVectorizer

* kernel.set_params now raises attributeerror

* removed fig from plot_partial_dependence

* removed iid parameter of search estimators

* removed brier_scorer

* raise error in split when shuffle is False and random_state is not None

* removed MultiOutputEstimator

* removed base classes of NaiveBayes

* removed drop from pipeline

* removed utils in random_projection

* removed presort and classes_ in trees

* flake8

* fixed some tests

* flake

* fixed docstring

* fixed other one

* some left

* mmmm
2020-05-20 16:04:14 -04:00
Kyle Kosic b4e215c01c
FEA Additional `TimeSeriesSplit` Functionality (#13204)
Co-authored-by: Kyle Kosic <kylekosic@Kyles-MacBook-Pro.local>
Co-authored-by: Thomas J Fan <thomasjpfan@gmail.com>
2020-05-11 21:48:01 -04:00
Lucy Liu c7a4bc9b3a
TST Replace Boston dataset in test_validation (#17146) 2020-05-08 17:53:15 -04:00