Skip to content

DOC: Clarify cv parameter description in GridSearchCV #12495

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Nov 12, 2018

Conversation

QBatista
Copy link
Contributor

Reference Issues/PRs

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

- Rewrite the parameter description
- Link the `CV splitter` description to an existing example
- Add an example with a custom iterable
Copy link
Member

@jnothman jnothman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is relevant to all other *CV and cross validation functions... This pull request should change many docstrings if it changes one

@@ -901,8 +901,10 @@ class GridSearchCV(BaseSearchCV):

- None, to use the default 3-fold cross validation,
- integer, to specify the number of folds in a `(Stratified)KFold`,
- An object to be used as a cross-validation generator.
- An iterable yielding train, test splits.
- A :term:`CV splitter <CV splitter>` object. See
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:term:`CV splitter` should be sufficient

- A :term:`CV splitter <CV splitter>` object. See
:ref:`sphx_glr_auto_examples_svm_plot_rbf_parameters.py` for
an example.
- An iterable yielding train, test splits as arrays of indices.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(train, test)

@@ -982,6 +984,34 @@ class GridSearchCV(BaseSearchCV):
'split2_test_score', ...
'std_fit_time', 'std_score_time', 'std_test_score']

>>> from sklearn import svm, datasets
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This rather belongs in doc/modules/grid_search.rst or
../cross_validation.rst or doc/glossary.rst if not covered in those already

@QBatista
Copy link
Contributor Author

QBatista commented Nov 3, 2018

@jnothman Thanks for your comments! I've made changes to the following CV and cross validation functions in addition to GridSearchCV:

  • check_cv
  • RandomizedSearchCV
  • cross_validate
  • cross_val_predict
  • cross_val_score
  • learning_curve
  • permutation_test_score
  • validation_curve

There are other places where the cv parameter is used such as ClassifierChain. Should I update them as well? Also, there seems to be a redundancy in the glossary: there is both CV splitter and cross-validation splitter. Is this intended or should one of them be removed?

@jnothman
Copy link
Member

jnothman commented Nov 5, 2018 via email

Copy link
Member

@jnothman jnothman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

git grep -p "An object to be used as a" shows many more places where you should make this change.

@@ -63,8 +63,8 @@ class CalibratedClassifierCV(BaseEstimator, ClassifierMixin):

- None, to use the default 3-fold cross-validation,
- integer, to specify the number of folds.
- An object to be used as a cross-validation generator.
- An iterable yielding train/test splits.
- :term:`CV splitter <CV splitter>`,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You still shouldn't have that expression in angle brackets. It is unnecessary when the text to display is the same as the link target name

@QBatista
Copy link
Contributor Author

QBatista commented Nov 9, 2018

@jnothman Thanks for letting me know! Hopefully, everything is now alright.

@amueller amueller merged commit 4b78d7a into scikit-learn:master Nov 12, 2018
thoo added a commit to thoo/scikit-learn that referenced this pull request Nov 12, 2018
…ybutton

* upstream/master:
  DOC: Clarify `cv` parameter description in `GridSearchCV` (scikit-learn#12495)
thoo pushed a commit to thoo/scikit-learn that referenced this pull request Nov 13, 2018
…rn#12495)

#### Reference Issues/PRs
<!--
Example: Fixes scikit-learn#1234. See also scikit-learn#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 scikit-learn#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 scikit-learn#12466
thoo added a commit to thoo/scikit-learn that referenced this pull request Nov 13, 2018
…ikit-learn into add_codeblock_copybutton

* 'add_codeblock_copybutton' of https://github.com/thoo/scikit-learn:
  Move an extension under sphinx_copybutton/
  Move css/js file under sphinxext/
  Fix max_depth overshoot in BFS expansion of trees (scikit-learn#12344)
  TST don't test utils.fixes docstrings (scikit-learn#12576)
  DOC Fix typo (scikit-learn#12563)
  FIX Workaround limitation of cloudpickle under PyPy (scikit-learn#12566)
  MNT bare asserts (scikit-learn#12571)
  FIX incorrect error when OneHotEncoder.transform called prior to fit (scikit-learn#12443)
  Retrigger travis:max time limit error
  DOC: Clarify `cv` parameter description in `GridSearchCV` (scikit-learn#12495)
  FIX remove FutureWarning in _object_dtype_isnan and add test (scikit-learn#12567)
  DOC Add 's' to "correspond" in docs for Hamming Loss. (scikit-learn#12565)
  EXA Fix comment in plot-iris-logistic example (scikit-learn#12564)
  FIX stop words validation in text vectorizers with custom preprocessors / tokenizers (scikit-learn#12393)
  DOC Add skorch to related projects (scikit-learn#12561)
  MNT Don't change self.n_values in OneHotEncoder.fit (scikit-learn#12286)
  MNT Remove unused assert_true imports (scikit-learn#12560)
  TST autoreplace assert_true(...==...) with plain assert (scikit-learn#12547)
  DOC: add a testimonial from JP Morgan (scikit-learn#12555)
thoo pushed a commit to thoo/scikit-learn that referenced this pull request Nov 14, 2018
…rn#12495)

#### Reference Issues/PRs
<!--
Example: Fixes scikit-learn#1234. See also scikit-learn#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 scikit-learn#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 scikit-learn#12466
jnothman pushed a commit to jnothman/scikit-learn that referenced this pull request Nov 14, 2018
…rn#12495)

#### Reference Issues/PRs
<!--
Example: Fixes scikit-learn#1234. See also scikit-learn#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 scikit-learn#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 scikit-learn#12466
jnothman pushed a commit to jnothman/scikit-learn that referenced this pull request Nov 14, 2018
…rn#12495)

#### Reference Issues/PRs
<!--
Example: Fixes scikit-learn#1234. See also scikit-learn#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 scikit-learn#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 scikit-learn#12466
xhluca pushed a commit to xhluca/scikit-learn that referenced this pull request Apr 28, 2019
…rn#12495)

#### Reference Issues/PRs
<!--
Example: Fixes scikit-learn#1234. See also scikit-learn#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 scikit-learn#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 scikit-learn#12466
xhluca pushed a commit to xhluca/scikit-learn that referenced this pull request Apr 28, 2019
xhluca pushed a commit to xhluca/scikit-learn that referenced this pull request Apr 28, 2019
koenvandevelde pushed a commit to koenvandevelde/scikit-learn that referenced this pull request Jul 12, 2019
…rn#12495)

#### Reference Issues/PRs
<!--
Example: Fixes scikit-learn#1234. See also scikit-learn#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 scikit-learn#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 scikit-learn#12466
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

GridSearchCV lacking documentation for cv parameter
4 participants