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
7 changes: 5 additions & 2 deletions examples/grid_search_digits.py
Expand Up @@ -59,9 +59,12 @@
print() print()
print("Grid scores on development set:") print("Grid scores on development set:")
print() 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" print("%0.3f (+/-%0.03f) for %r"
% (mean_score, scores.std() / 2, params)) % (mean, std / 2, params))
print() print()


print("Detailed classification report:") print("Detailed classification report:")
Expand Down
8 changes: 2 additions & 6 deletions examples/svm/plot_rbf_parameters.py
Expand Up @@ -105,12 +105,8 @@
pl.axis('tight') pl.axis('tight')


# plot the scores of the grid # plot the scores of the grid
# cv_scores_ contains parameter settings and scores scores = grid.search_results_['test_score']
score_dict = grid.cv_scores_ scores = scores.reshape(len(C_range), len(gamma_range))

# We extract just the scores
scores = [x[1] for x in score_dict]
scores = np.array(scores).reshape(len(C_range), len(gamma_range))


# draw heatmap of accuracy as a function of gamma and C # draw heatmap of accuracy as a function of gamma and C
pl.figure(figsize=(8, 6)) pl.figure(figsize=(8, 6))
Expand Down
2 changes: 1 addition & 1 deletion examples/svm/plot_svm_scale_c.py
Expand Up @@ -131,7 +131,7 @@
cv=ShuffleSplit(n=n_samples, train_size=train_size, cv=ShuffleSplit(n=n_samples, train_size=train_size,
n_iter=250, random_state=1)) n_iter=250, random_state=1))
grid.fit(X, y) grid.fit(X, y)
scores = [x[1] for x in grid.cv_scores_] scores = grid.search_results_['test_score']


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