W3cubDocs

/scikit-learn

sklearn.model_selection.check_cv

sklearn.model_selection.check_cv(cv=’warn’, y=None, classifier=False) [source]

Input checker utility for building a cross-validator

Parameters:
cv : int, cross-validation generator or an iterable, optional

Determines the cross-validation splitting strategy. Possible inputs for cv are:

  • 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.

For integer/None inputs, if classifier is True and y is either binary or multiclass, StratifiedKFold is used. In all other cases, KFold is used.

Refer User Guide for the various cross-validation strategies that can be used here.

Changed in version 0.20: cv default value will change from 3-fold to 5-fold in v0.22.

y : array-like, optional

The target variable for supervised learning problems.

classifier : boolean, optional, default False

Whether the task is a classification task, in which case stratified KFold will be used.

Returns:
checked_cv : a cross-validator instance.

The return value is a cross-validator which generates the train/test splits via the split method.

© 2007–2018 The scikit-learn developers
Licensed under the 3-clause BSD License.
http://scikit-learn.org/stable/modules/generated/sklearn.model_selection.check_cv.html