Skip to content
7 changes: 5 additions & 2 deletions examples/grid_search_digits.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:")
Expand Down
8 changes: 2 additions & 6 deletions examples/svm/plot_rbf_parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
2 changes: 1 addition & 1 deletion examples/svm/plot_svm_scale_c.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand Down
Loading