Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH extensible parameter search results #1787

Closed
6 changes: 4 additions & 2 deletions examples/grid_search_digits.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,11 @@
print()
print("Grid scores on development set:")
print()
for params, mean_score, scores in clf.cv_scores_:
means = clf.grid_results_['test_score']
stds = clf.fold_results_['test_score'].std(axis=1)
for params, mean, std in zip(clf.grid_results_['parameters'], 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.grid_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.grid_results_['test_score']

scales = [(1, 'No scaling'),
((n_samples * train_size), '1/n_samples'),
Expand Down
Loading