def cross_val_score(estimator, X, y=None, groups=None, scoring=None, cv=None, n_jobs=1, verbose=0, fit_params=None, pre_dispatch='2*n_jobs'):
 (X, y, groups) = indexable(X, y, groups)
 cv = check_cv(cv, y, classifier=is_classifier(estimator))
 scorer = check_scoring(estimator, scoring=scoring)
 parallel = Parallel(n_jobs=n_jobs, verbose=verbose, pre_dispatch=pre_dispatch)
 scores = parallel((delayed(_fit_and_score)(clone(estimator), X, y, scorer, train, test, verbose, None, fit_params) for (train, test) in cv.split(X, y, groups)))
 return np.array(scores)[:, 0]

def cross_val_score ( estimator , X , y = None , groups = None , scoring = None , cv = None , n_jobs = 1 , verbose = 0 , fit_params = None , pre_dispatch = '2*n_jobs' ) : ( X , y , groups ) = indexable ( X , y , groups ) cv = check_cv ( cv , y , classifier = is_classifier ( estimator ) ) scorer = check_scoring ( estimator , scoring = scoring ) parallel = Parallel ( n_jobs = n_jobs , verbose = verbose , pre_dispatch = pre_dispatch ) scores = parallel ( ( delayed ( _fit_and_score ) ( clone ( estimator ) , X , y , scorer , train , test , verbose , None , fit_params ) for ( train , test ) in cv . split ( X , y , groups ) ) ) return np . array ( scores ) [ : , 0 ]
evaluate a score by cross-validation .