Commit Graph

406 Commits

Author SHA1 Message Date
Thomas J. Fan 3ae7c76153
STY Enables black with experimental_string_processing=true (#20412) 2021-06-29 09:47:04 +02:00
Thomas J. Fan 383b53fa91
FIX Uses code literals in deprecated to prevent linking (#20410)
Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>
2021-06-28 15:49:19 +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
Thomas J. Fan e68886faca
STY Minor fix for black formatting (#20289) 2021-06-17 13:19:35 -04:00
Guillaume Lemaitre 05319e727b
TST common tests for n_features_in_ for model_selection module (#20204)
Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>
2021-06-15 19:20:20 +02:00
Guillaume Lemaitre 6484c4f0ec
TST add HalvingSearchCV to common test (#20203) 2021-06-15 18:16:50 +02:00
Thomas J. Fan 9a13bdfaf1
MNT Adds black config and fixes formatting before black (#19031)
Co-authored-by: Roman Yurchak <rth.yurchak@gmail.com>
Co-authored-by: Christian Lorentzen <lorentzen.ch@gmail.com>
2021-06-12 17:14:09 +02:00
Pablo Duque 978c91bbe9
Make BaseShuffleSplit public (#20056) 2021-06-12 15:23:58 +02:00
Guillaume Lemaitre 1cd282d600
DOC add n_features_in_ in the documentation (#20236) 2021-06-09 16:58:03 +02:00
Jérémie du Boisberranger b15e312b29
TST test_fit_docstring_attributes include properties (#20190) 2021-06-07 17:48:17 -04: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
Alihan Zihna 734ae1f2df
DOC add explicit message regarding shuffling in default CV (#19776)
Co-authored-by: Alihan Zihna <a.zihna@ckhgbdp.onmicrosoft.com>
2021-04-09 10:37:15 +02:00
Nicolas Hug 309f135c32
MNT Remove HistGradientBoosting from experimental (#19799) 2021-04-02 16:40:20 +02:00
guiweber 81102146e3
DOC Fixed typo in cross_val_predict docstring (#19739) 2021-03-21 15:06:12 -04: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
Ashish 70c6ac9d04
DOC Fixed typos in documentation (#19511) 2021-02-20 12:01:19 -05:00
Atsushi Nukariya b5e55f79fd
TST replace assert_warns* by pytest.warns in model_selection/tests (#19458) 2021-02-19 11:44:09 +01:00
Thomas J. Fan 95fa18f278
TST Fixes docstring ordering and test_docstring_parameters (#19048) 2021-02-12 11:35:05 +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 e4ae68f09a
DOC add info regarding support of dict of multimetric scores (#19205)
Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>
2021-01-19 17:53:22 -05:00
shinnar c83125c04b
DOC Fix docstring of HalvingSearch estimators (#19133) 2021-01-08 08:12:02 +00: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
Christoph Deil edc48e1383
DOC Fix docstring RST formatting in TimeSeriesSplit (#18816) 2020-11-11 21:31:00 -05:00
Kiril Isakov 35b3195958
DOC add link to stratification UG for train_test_split (#18735) 2020-11-10 16:11:05 +00: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 ed4e539237
TST enable common tests for SearchCV (#18158) 2020-10-12 16:17:17 +02:00
Nicolas Hug e6555decf8
DOC minor typo fix in successive halving (#18601) 2020-10-11 13:13:25 -04: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
Ankit Choraria 9120be9d65
DOC remove irrelevant parts in _validation.py (#18548) 2020-10-07 08:15:40 -04: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 e2583d45f7
DOC put back original anchor to avoid breaking links (#18551) 2020-10-06 23:45:16 -04:00
Nicolas Hug 521b3f289a
MNT Minor refactoring _fit_and_predict (#18471) 2020-09-30 12:35:46 +02:00
Frans Larsson c7d29e31bf
DOC Fix default values in _validation.py (#18337)
Co-authored-by: Juan Carlos Alfaro Jiménez <JuanCarlos.Alfaro@uclm.es>
2020-09-24 11:20:53 -04:00
Albert Villanova del Moral 547ed6b182
DOC Improve links in cross_validation's user guide (#18379) 2020-09-24 11:19:09 -04:00
Thomas J. Fan 06d6f8a9f6
FIX Passes global configuration when spawning joblib jobs (#17634)
* WIP

* BUG Passes context to joblib jobs

* BUG Fix

* BUG Fix

* CLN Moves delayed into fixes

* CLN Adds linter

* REV Revert diff

* DOC Adds comment for removal

* Use a simple implementation
2020-09-21 16:59:42 +02:00
Alex Itkes 8b68ea165c
DOC specify default of error_score in cross_validate (#14488) 2020-09-18 15:43:52 -04: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
Albert Villanova del Moral 647fcb1ac1
DOC Fix A to uppercase in See Also docstring section (#18332) 2020-09-04 10:35:01 -04:00
Albert Villanova del Moral 875d32fe55
DOC Fix versionadded/versionchanged for 0.24 (#18312) 2020-09-01 10:51:01 +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