From 389ed8dbfd018c5ebf6bbf510cb739b1133aca71 Mon Sep 17 00:00:00 2001 From: Alexander Fabisch Date: Sat, 11 Jan 2014 16:34:17 +0100 Subject: [PATCH] Log score and time in 'cross_val_score' --- sklearn/cross_validation.py | 3 +++ sklearn/grid_search.py | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/sklearn/cross_validation.py b/sklearn/cross_validation.py index 377dbcced6572..080206f03441c 100644 --- a/sklearn/cross_validation.py +++ b/sklearn/cross_validation.py @@ -1119,6 +1119,9 @@ def _cross_val_score(estimator, X, y, scorer, train, test, scoring_time = time.time() - start_time + if verbose > 1: + print("score %f in %f s" % (score, scoring_time)) + return score, _num_samples(X_test), scoring_time diff --git a/sklearn/grid_search.py b/sklearn/grid_search.py index 4db7d435256a8..eac8823656439 100644 --- a/sklearn/grid_search.py +++ b/sklearn/grid_search.py @@ -236,7 +236,8 @@ def fit_grid_point(X, y, estimator, parameters, train, test, scorer, estimator.set_params(**parameters) score, n_samples_test, scoring_time = _cross_val_score( - estimator, X, y, scorer, train, test, verbose, fit_params) + estimator, X, y, scorer, train, test, verbose=0, + fit_params=fit_params) if verbose > 2: msg += ", score=%f" % score