Skip to content

Commit

Permalink
EXAMPLE remove examples' uses of *SearchCV.cv_scores_
Browse files Browse the repository at this point in the history
  • Loading branch information
jnothman committed Apr 7, 2013
1 parent 9005683 commit 6d96923
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
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

0 comments on commit 6d96923

Please sign in to comment.