sklearn.cross_validation
.check_cv¶
-
sklearn.cross_validation.
check_cv
(cv, X=None, y=None, classifier=False)[source]¶ Input checker utility for building a CV in a user friendly way.
Parameters: cv : int, a cv generator instance, or None
The input specifying which cv generator to use. It can be an integer, in which case it is the number of folds in a KFold, None, in which case 3 fold is used, or another object, that will then be used as a cv generator.
X : array-like
The data the cross-val object will be applied on.
y : array-like
The target variable for a supervised learning problem.
classifier : boolean optional
Whether the task is a classification task, in which case stratified KFold will be used.
Returns: checked_cv: a cross-validation generator instance. :
The return value is guaranteed to be a cv generator instance, whatever the input type.