This documentation is for scikit-learn version 0.11-gitOther versions

Citing

If you use the software, please consider citing scikit-learn.

This page

8.3.10. sklearn.cross_validation.cross_val_score

sklearn.cross_validation.cross_val_score(estimator, X, y=None, score_func=None, cv=None, n_jobs=1, verbose=0)

Evaluate a score by cross-validation

Parameters :

estimator: estimator object implementing ‘fit’ :

The object to use to fit the data

X: array-like of shape at least 2D :

The data to fit.

y: array-like, optional :

The target variable to try to predict in the case of supervised learning.

score_func: callable, optional :

callable, has priority over the score function in the estimator. In a non-supervised setting, where y is None, it takes the test data (X_test) as its only argument. In a supervised setting it takes the test target (y_true) and the test prediction (y_pred) as arguments.

cv: cross-validation generator, optional :

A cross-validation generator. If None, a 3-fold cross validation is used or 3-fold stratified cross-validation when y is supplied and estimator is a classifier.

n_jobs: integer, optional :

The number of CPUs to use to do the computation. -1 means ‘all CPUs’.

verbose: integer, optional :

The verbosity level