- sklearn.cross_validation.cross_val_score(estimator, X, y=None, score_func=None, cv=None, n_jobs=1, verbose=0, fit_params=None)¶
Evaluate a score by cross-validation
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
Score function to use for evaluation. 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.
fit_params : dict, optional
Parameters to pass to the fit method of the estimator.
scores : array of float, shape=(len(list(cv)),)
Array of scores of the estimator for each run of the cross validation.