Commit Graph

163 Commits

Author SHA1 Message Date
Adrin Jalali 51c8e0e19d
CLN replace authors with the standard line (#29250) 2024-06-17 17:57:02 +00:00
Adrin Jalali 55ca335e42
CLN use new license notice line (#29246) 2024-06-13 15:51:09 +02:00
Tim Head 5692e5961e
ENH Add Array API compatibility tests for `*SearchCV` classes (#27096)
Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>
Co-authored-by: Omar Salman <omar.salman@arbisoft.com>
2024-06-07 10:38:28 +00:00
Tialo 945273d297
DOC Fix default value of n in check_cv (#29024) 2024-05-16 10:11:54 +02:00
Tim Head e5a7c3e39f
FIX Fix array API `train_test_split` (#28407)
Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>
2024-03-18 15:43:09 +01:00
Lucy Liu 38b39a4031
DOC Fix `GroupKFold` docstring (#28540) 2024-02-28 10:05:29 +01:00
Jérémie du Boisberranger f323eb48a8
MAINT cleanup utils.__init__: move safe_sqr and _approximate_mode into extmath (#28481)
Co-authored-by: Loïc Estève <loic.esteve@ymail.com>
2024-02-21 12:17:20 +01:00
Thomas J. Fan 1106c91293
ENH Adds warning & docs for splitters that do not support goups (#28210)
Co-authored-by: Loïc Estève <loic.esteve@ymail.com>
2024-01-26 14:19:09 +01:00
DUONG 2b07c87e5b
DOC add examples for sklearn.model_selection (#28013)
Co-authored-by: Guillaume Lemaitre <g.lemaitre58@gmail.com>
2024-01-12 18:28:59 +01:00
scaja f113327bf1
DOC linked SplineTransformer to time-related feature engineering example (#26971)
Co-authored-by: scaja <scajadata@gmail.com>
Co-authored-by: adrinjalali <adrin.jalali@gmail.com>
2023-12-04 15:44:21 +00:00
Yao Xiao 365ce39940
DOC minor fixes of cross-validation splitter docstrings (#27790) 2023-11-16 11:22:16 +01:00
MN193 a337410f78
DOC add link to plot_cv_indices example in _split (#27244)
Co-authored-by: Adrin Jalali <adrin.jalali@gmail.com>
2023-09-17 13:09:29 +02:00
Mateusz Sokół cb15a82e64
MAINT: Remove np.in1d and np.trapz usages (#27140)
Co-authored-by: Loïc Estève <loic.esteve@ymail.com>
2023-09-06 17:06:31 +02:00
Adrin Jalali 8e867b3fdb
MNT fix ruff type vs isinstance errors (#27039) 2023-08-09 09:44:31 +00:00
Jérémie du Boisberranger 04575f5fa3
MAINT Param validation: apply skip nested validation to all functions (#26495) 2023-06-22 18:06:24 +02:00
Adrin Jalali 42173fdb34
MNT add isort to ruff's rules (#26649) 2023-06-21 17:50:07 +02:00
Adrin Jalali 62671a704f
FEAT SLEP006: metadata routing infrastructure (#24027)
Co-authored-by: Christian Lorentzen <lorentzen.ch@gmail.com>
Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>
Co-authored-by: Benjamin Bossan <BenjaminBossan@users.noreply.github.com>
Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>
Co-authored-by: Omar Salman <omar.salman@arbisoft.com>
2023-06-02 16:43:31 -04:00
Adrin Jalali 893d5accaf
MNT Update black to 23.3.0 (#26110) 2023-04-06 12:14:16 -04:00
Jérémie du Boisberranger 9d55835574
MAINT Ensure disjoint interval constraints (#25797) 2023-03-15 14:44:09 -04:00
Christian Veenhuis 610a0ce970
DOC unify usage of 'w.r.t.' (#25683) 2023-02-24 09:51:02 +01:00
Guillaume Lemaitre b01f018c9b
FIX ignore *args and **kwargs in parameter validation of public functions (#25114)
Co-authored-by: Jérémie du Boisberranger <34657725+jeremiedbb@users.noreply.github.com>
closes https://github.com/scikit-learn/scikit-learn/issues/25113
2022-12-05 17:13:05 +01:00
Lucy Liu 57a243c95f
DOC Improve format in docstring code examples of splitters (#24475) 2022-09-28 10:45:47 +02:00
Lucy Liu bfe68b4641
DOC Improve format in code examples of splitters (#24466) 2022-09-19 16:41:29 +02:00
Biswaroop Mitra 0f0c4cef19
DOC improve and correct typo in docstring (#24417)
Co-authored-by: Guillaume Lemaitre <g.lemaitre58@gmail.com>
2022-09-12 10:51:29 +02:00
Lucy Liu b4c2ebfcd8
DOC Clarify when GroupKFold same as LeaveOneGroupOut (#24104) 2022-09-09 21:20:36 -04:00
Lucy Liu c9d6a2769a
DOC Clarify LeaveOneGroupOut (#24159) 2022-08-24 18:19:26 +02:00
Timofei Kornev e76fbcf7d8
DOC Improve doc for GroupKFold and StratifiedGroupKFold (#23948)
Co-authored-by: Julien Jerphanion <git@jjerphan.xyz>
2022-07-27 16:28:59 +02:00
Lucy Liu 968beaaa22
DOC Improve group based CV splitter docs (#23861) 2022-07-26 12:06:14 +02:00
Lucy Liu c63e38add5
MNT Move base._pprint into model_selection._split (#23883) 2022-07-15 10:06:53 -07:00
Sam Adam Day 3275beab03
DOC/TST Clarify group order in GroupKFold and LeaveOneGroupOut (#22582) 2022-05-06 17:40:26 +02:00
Chloe-Agathe Azencott babc517f7a
Fixed sklearn.model_selection._split.check_cv docstring in #21350 (#22778) 2022-03-12 15:21:41 +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
Arisa 4c9bf8bbae
DOC Ensures that train_test_split passes numpydoc validation (#21435) 2021-10-23 22:34:11 +02:00
genvalen 642127806a
DOC use backticks for n_samples and n_features in X docstring (#20914) 2021-09-02 13:35:03 +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
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
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
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
Nicolas Hug e2583d45f7
DOC put back original anchor to avoid breaking links (#18551) 2020-10-06 23:45:16 -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
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
Frans Larsson c6579afdc4
DOC add None as valid option to random_state in model_selection module (#18232) 2020-08-22 17:32:36 +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
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
Hugo Le Moine 8abe0a822e
MNT Replaced kwargs by named args for train_test_split (#17216) 2020-05-14 09:21:01 -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