Commit Graph

70 Commits

Author SHA1 Message Date
Hanmin Qin 5533deb8e0 [MRG] FIX Support cv=None in *CV (#11761) 2018-08-07 11:53:59 +10:00
ZJ Poh adddf00433 [MRG] np.ones -> np.full (#11628) 2018-07-23 09:49:01 +02:00
Alexandre Boucaud f158e2dfe2 [MRG+1] Change CV defaults to 5 (#11557)
* add FutureWarning for methods with defaults=3

* add explicit cv values to fix assertion errors

* add tests for catching the FutureWarning

* Write current deprecation version

* Add deprecation in docstring

* change default cv value to None

* change cv from 3 to 5 in the examples

* upgrade doctests

* update doctest in tutorial

* update doctest in cross-validation doc

* fix tests

* add entry to whats new

* address Gael comments

* address Gael comments 2

* fix wrong indentation

* update doc

* add docstring deprecation warning in CV subclasses

* address Andy's comments

* fix PR number

* fix flake8

* add filterwarnings in tests

* fix doctests

* cv=None mendatory in Ridge

* fix warning related errors

* skip some doctests warnings

* make travis happy

* change from deprecated to versionchanged

* fix doctests and remove skipping

* address comments
2018-07-19 14:46:11 +02:00
Roman Yurchak c09352c241 [MRG] Fix DeprecationWarning due to collections.abc in Python 3.7 (#11431)
Closes https://github.com/scikit-learn/scikit-learn/issues/11121

This PR removes the deprecation warning about ABC being moved from `collections` to `collections.abc` when importing scikit-learn in Python 3.7.

In the end, I put `collections.abc.{Sequence, Iterable, Mapping, Sized}` in the namespace of `sklearn.utils.fixes`. This was the simplest way I could find, and while it has the drawback of obfuscating the real module name, other approached appeared more problematic and a similar approach is currently used e.g. for `utils.fixes.signature` which is an alias for `inspect.signature`.

We can't just patch six with https://github.com/benjaminp/six/pull/241, because sklearn uses six from 5 years ago, which would  need updating and I'm not sure if it could have side effects (e.g. for pickling backward compatibility etc).

**Edit**: This adds a test checking that generally no warnings are raised when importing scikit-learn top-level modules.
2018-07-14 15:14:02 -05:00
Andreas Mueller eec7649236 MAINT Complete 0.20 deprecations (#9570) 2018-06-24 23:06:26 +10:00
Andrew Peng f1a3312cd7 FIX #11215 : Changing return in docstring to yields for generator functions (#11276) 2018-06-15 21:50:01 +00:00
Jason Wolosonovich 0dec5b669c DOC: added default value for test_size in train_test_split (#11068) 2018-05-06 11:31:25 +10:00
Nicholas Nadeau, P.Eng., AVS 3e26fc63be MAINT Fixing Typos (#11017) 2018-04-24 09:32:25 +10:00
Will Rosenfeld f96ee8d730 DOC Remove random_state note from TimeSeriesSplit, and add where needed (#10696) 2018-02-28 18:41:58 +11:00
William de Vazelhes de9d05f426 [MRG+1]DOC StratifiedKFold docstring fix (#10155) 2018-01-18 09:12:31 +08:00
Jeb Bearer ea6ea815e1 MAINT Hide train_test_split from nose test discovery. (#10223) 2017-12-07 08:15:20 +11:00
Nicolas Hug 02c7f986eb Fix typo in ShuffleSplit docstring and effective_n_jobs (#10182) 2017-11-21 14:48:07 -05:00
Loïc Estève e7e05d844f [MRG+1] Remove nose from CIs and documentation (#9840) 2017-11-16 20:20:35 +01:00
Charlie Brummitt d074e403f1 [MRG+1] Fix bug in StratifiedShuffleSplit for multi-label data with targets having > 1000 labels (#9922)
* Use ' '.join(row) for multi-label targets in StratifiedShuffleSplit because str(row) uses an ellipsis when len(row) > 1000
* Add a new test for multilabel problems with more than a thousand labels
2017-10-17 09:44:35 +02:00
Andreas Mueller 94fa697356 [MRG+1] check that splitters handle 2d y and give reasonable errors on multilabel y (#9744) 2017-10-09 11:22:15 +02:00
Albert Thomas 45dc891c96 [MRG+2] Clean common tests (#9340)
* rm dupes

* add check_supervised_y_no_nan in classifier checks: this implies changes for Ridge classifiers

* fix docstrings/comments

* FIX check fitting 1d X array raises error and FIX check fitting 2d array with only 1 feature either works or returns informative message

* modify check_fit2d_1sample in common tests so that it checks fitting either works or returns an informative message

* rm SpectralClustering case for the moment

* uniformize error messages for 1 sample case and fix SpectralClustering with ensure_min_samples=2

* add unit test for mean_shift when n_samples * quantile < 1

* FIX travis with ensure_min_samples=2 in _PLS

* try fix for failing tSNE test

* typos

* take @agramfort's review into account

* sc to fix string in gaussian_process

* add the class that is present to preserve information of previous message in gpc.py
2017-09-26 18:13:15 +02:00
Kye Taylor a324a61eea [MRG+1] Fix #9743: Adding parameter information to docstring. (#9757)
* Adding parameter information to docstring.

* Removing trailing whitespace from lines.

* Adding details of parameter to formal Parameters section.

* Shortened lines to meet requirements.
2017-09-15 11:17:45 +10:00
Andreas Mueller 334850fa2b Note->Notes, fix underline in multioutput examples (#9416) 2017-07-20 14:01:30 +02:00
Balakumaran Manoharan 7b7960ef87 [MRG + 1] Fix wrong error message in StratifiedKFold (#9396)
* Fix wrong error message in StratifiedKFold

* Remove groups in warning message
2017-07-19 09:25:27 +10:00
(Venkat) Raghav, Rajagopalan 75d6005fea [MRG] Add few more tests + Documentation for re-entrant cross-validation estimators (#7823)
* DOC Add NOTE that unless random_state is set, split will not be identical

* TST use np.testing.assert_equal for nested lists/arrays

* TST Make sure cv param can be a generator

* DOC rank_ becomes a link when rendered

* Use test_...

* Remove blank line; Add if shuffle is True

* Fix tests

* Explicitly test for GeneratorType

* TST Add the else clause

* TST Add comment on usage of np.testing.assert_array_equal

* TYPO

* MNT Remove if ;

* Address Joel's comments

* merge the identical points in doc

* DOC address Andy's comments

* Move comment to before the check for generator type
2017-07-17 08:58:59 +10:00
Joel Nothman 0cdd91d8e4 [MRG] COSMIT Remove unused parameters in private functions (#9310)
* Remove unused parameter

* COSMIT another unused parameter

* COSMIT another unused parameter
2017-07-10 10:22:00 +02:00
Andreas Mueller 5271a193c3 MRG Sphinx fixes (#9155) 2017-06-28 17:00:13 +02:00
Joel Nothman 3c6c913bd8 [MRG+2] ENH Speed up StratifiedShuffleSplit (#9197)
* ENH Speed up StratifiedShuffleSplit

* Doc balance parentheses in comment
2017-06-26 12:56:40 -07:00
Nelson Liu 1f781e64a2 [MRG+3] CV splitters: train/test_size default behavior will change in 0.21 (#7459) 2017-06-14 21:28:52 +10:00
Vlad Niculae 93563b0ac1 [MRG+1] fix StratifiedShuffleSplit with 2d y (#9044)
* regression test and fix for 2d stratified shuffle split

* strengthen non-overlap sss tests

* clarify test and comment

* remove iter from tests, use str instead of hash
2017-06-13 17:40:45 +05:30
Naoya Kanai 95aa2952e1 Add logsumexp and comb to utils.fixes (#9046) 2017-06-10 15:01:02 +02:00
Alexandre Gramfort 32f2418a07 use ValueError 2017-06-08 11:44:54 +02:00
themrmax eaebfe0535 [MRG+1] add shuffle paramater to train_test_split (#8845)
* add shuffle paramater to train_test_split

* fix syntax error

* fix variable name

* fix formatting in doctest output

* fix doctest output

* refactor shuffle paramater into ShuffleSplit and StratifiedShuffleSplit

* include shuffle option in tests

* rollback refactor

* revert to simpler version of unshuffled split

* fix flake8 errors

* revert changes to ShuffleSplit

* revert BaseShuffleSplit

* more reversions

* fix indentation

* remove shuffle parameter from CVclass

* add text to NotImplementedError

* change indexing to use numpy.arange rather than range

* specify precondition for stratify to be None in docstring
2017-06-08 11:43:22 +02:00
Aman Dalmia 511c9a8655 [MRG+1] ENH: added max_train_size to TimeSeriesSplit (#8282)
* ENH: added max_train_size to TimeSeriesSplit

* FIX: update doctest

* FIX: correct error in the previous update

* FIX: added doctest fix for cross_validation.rst

* FIX: remove errors

* TST: tests updated and default value changed to None

* TST: improve split tests

* FIX: reduce code length
2017-06-08 10:51:40 +02:00
Naoya Kanai 6579220588 [MRG+1] Drop NumPy < 1.8 (#8874) 2017-06-07 17:06:06 +02:00
Hanmin Qin 41b84f84cc [MRG+1] Change the restriction of n_repeats in RepeatedKFold and RepeatedStratifiedKFold (#8909)
* change the restriction of n_repeats

* change test case
2017-06-05 16:51:17 +02:00
Toshihiro Kamishima 754109c78d [MRG+1] enable to use get_n_splits of LeaveOneGroupOut and LeavePGroupsOut with dummy parameters (#8794)
* remove needless argument checking

* add parameter checking as in LeavePGroupsOut

* add examples with dummy inputs

* add unittest for a get_n_splits method in LeaveOneGroupOut and LeavePGroupsOut classes

* X and y can be ommited in a get_n_splits function.

* fix error messages

* update examples

* fix test for an error message

* Revert "fix test for an error message"

This reverts commit 68b984207c.

* fix test for an error message

* fix error messages

* remove tailing white spaces

* add periods to messages

* test for ValueError’s of get_n_splits methods of LeaveOneOut / LeavePOut classes

* fix documents:
* parameter name: group -> groups
* modfy white space
2017-05-12 14:56:13 +02:00
AishwaryaRK b57837188d [MRG] Fixes #8736 add get_n_splits for RepeatedKFold and RepeatedStratifiedKFold (#8802) 2017-04-29 21:33:32 +10:00
Guillaume Lemaitre e3c9ae204f [MRG+1] DOC improve description and consistency of random_state (#8689)
* DOC improve description of random_state in train_test_split

* DOC Make random_state consistent through documentation

* FIX reverse doc mistake

* FIX address comment of Tom

* DOC address comments

* DOC remove empty line

* DOC remove unecessary white spaces
2017-04-05 17:43:21 -07:00
Neeraj Gangwar af1796ef68 [MRG+1] Repeated K-Fold and Repeated Stratified K-Fold (#8120)
* Add _RepeatedSplits and RepeatedKFold class

* Add RepeatedStratifiedKFold and doc for repeated cvs

* Change default value of n_repeats

* Change input parameters of repeated cv constructor to n_splits, n_repeats, random_state

* Generate random states in split function rather than store it beforehand

* Doc changes, inheriting RepeatedKFold, RepeatedStratifiedKFold from _RepeatedSplits and other review changes

* Remove blank line, put testcases for deterministic split in loop and add StopIteration check in testcase

* Using rng directly as random_state param to create cv instance and added a check for cvargs

* Fix pep8 warnings

* Changing default values for n_splits and n_repeats and add entry in changelog

* Adding name to the feature

* Missing space
2017-03-04 15:39:04 -05:00
Joel Nothman 7e18252a9e COSMIT remove unused import (#7928) 2016-11-24 11:33:56 +11:00
Raghav RV 680a5b8a95 [MRG + 1] DOC Add whatsnew for the 3 model_selection bugfixes (#7868)
* DOC Add whatnew for the 3 mod-sel bugfixes

* Move to 0.18.1; Change name universally to Raghav RV

* Raghav R V --> Raghav RV

* Edit mailmap to include my other email
2016-11-15 11:25:41 +01:00
Raghav RV d7c956afc8 [MRG] FIX Validate and convert X, y and groups to ndarray before splitting (#7593) 2016-11-04 09:48:47 +11:00
Rafael Possas 304c67cab6 COSMIT delete untrue and obsolete comment 2016-11-02 00:39:57 +11:00
Raghav RV 38f6a91566 [MRG + 2] FIX Be robust to non re-entrant/ non deterministic cv.split calls (#7660) 2016-10-31 08:49:17 +11:00
polmauri 73d3f03cfc [MRG + 1] FIX raise an error message when n_groups > number of groups (#7681) (#7683)
* FIX raise an error message when n_groups > actual number of groups (#7681)

This change addresses issue #7681:
- Raise ValueError when n_groups > actual number of unique groups in LeaveOneGroupOut and LeavePGroupsOut.
- Add unit test.

* Make requested changes

- Check error message with `assert_raise_message`
- Pass parameters to `assert_raise_message` instead of defining functions

* Update condition and exception message
2016-10-25 11:42:39 -04:00
Russell Smith 54b0e4bf62 Add OneVs{One,All}Classifier._pairwise: fix for #7306 (#7350) 2016-09-20 13:46:45 +02:00
Raghav RV 9a12555e6d [MRG+1] ENH/MNT Rename labels --> groups in CV tools (#6660) 2016-09-11 19:14:41 +02:00
Andreas Mueller 31a4691d76 [MRG+1] fix sampling in stratified shuffle split (#6472)
Fix sampling in stratified shuffle split, break tests that test sampling.
2016-09-09 19:00:49 +02:00
Yen a7d748b1de Rename `TimeSeriesCV` to `TimeSeriesSplit` (#7245)
* rename TimeSeriesCV to TimeSeriesSplit

* Add TimeSeriesSplit

* Add whats new
2016-08-26 12:34:33 +10:00
Yen 234d25677d [MRG] Add homogeneous time series cross validation (#6586) 2016-08-24 23:15:38 +10:00
Nelson Liu 07e0dd3068
removed versionadded for arrays param and fixed spacing 2016-08-17 16:58:08 -07:00
Nelson Liu 8b6753db58
remove accidentally added whitespace 2016-08-17 16:43:14 -07:00
Nelson Liu 24af423e8f
edit docstring for arrays argument as well 2016-08-17 16:41:38 -07:00
Nelson Liu 5856a2c863
clarify splitting sparse data always outputs csr matrix 2016-08-17 14:14:04 -07:00