ENH extensible parameter search results #1787

Closed
wants to merge 9 commits into
from
@@ -59,9 +59,12 @@
print()
print("Grid scores on development set:")
print()
- for params, mean_score, scores in clf.cv_scores_:
+ candidates = clf.search_results_['parameters']
+ means = clf.search_results_['test_score']
+ stds = clf.fold_results_['test_score'].std(axis=1)
+ for params, mean, std in zip(candidates, means, stds):
print("%0.3f (+/-%0.03f) for %r"
- % (mean_score, scores.std() / 2, params))
+ % (mean, std / 2, params))
print()
print("Detailed classification report:")
@@ -105,12 +105,8 @@
pl.axis('tight')
# plot the scores of the grid
-# cv_scores_ contains parameter settings and scores
-score_dict = grid.cv_scores_
-
-# We extract just the scores
-scores = [x[1] for x in score_dict]
-scores = np.array(scores).reshape(len(C_range), len(gamma_range))
+scores = grid.search_results_['test_score']
+scores = scores.reshape(len(C_range), len(gamma_range))
# draw heatmap of accuracy as a function of gamma and C
pl.figure(figsize=(8, 6))
@@ -131,7 +131,7 @@
cv=ShuffleSplit(n=n_samples, train_size=train_size,
n_iter=250, random_state=1))
grid.fit(X, y)
- scores = [x[1] for x in grid.cv_scores_]
+ scores = grid.search_results_['test_score']
scales = [(1, 'No scaling'),
((n_samples * train_size), '1/n_samples'),
Oops, something went wrong.