* Fixed typo in an example
* Removed un-needed lines from example
* Added tests on the validity of parameters
* Fixed error msg for train_size issue
* Added tests to check the validation of test and train sizes
* Switched to parameterized test
* Fixed typo in error msg
* Swithced to pytest.raises
* Swithced to pytest.raises also when checking msg
* Improved the validity tests and their unit testing
#### Reference Issues/PRs
<!--
Example: Fixes#1234. See also #3456.
Please use keywords (e.g., Fixes) to create link to the issues or pull requests
you resolved, so that they will automatically be closed when your pull request
is merged. See https://github.com/blog/1506-closing-issues-via-pull-requests
-->
This PR addresses issue #12466.
#### What does this implement/fix? Explain your changes.
This PR does the 3 following things:
- Rewrite the `cv` parameter description in `GridSearchCV`
- Link the new `CV splitter` description to an existing example
- Add an example with a custom iterable
Thanks for reviewing this!
Close#12466
* 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
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.
* 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
* 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
* Adding parameter information to docstring.
* Removing trailing whitespace from lines.
* Adding details of parameter to formal Parameters section.
* Shortened lines to meet requirements.
* 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
* 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
* 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
* 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
* 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
* 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