4

Since _grid_scores_ method has been replaced by cv_results_ I would like to know how do I output the tuple with the parameters and scores? cv_results_ provides a dataframe for the score, but the tuple output was way easier to handle.

Please guide me towards handling parameter and score values in this new version of scikit. I plan to run a GridSearchCV for different ranges of parameters which I would latter consolidate into a single dictionary.

Vivek Kumar
  • 35,217
  • 8
  • 109
  • 132
Ankit Bansal
  • 317
  • 4
  • 14

1 Answers1

8

Use the for loop to print the results from cv_results_ as they were in grid_scores_.

From the documentation example:

clf = GridSearchCV(init params...)
clf.fit(train data...)

print("Best parameters set found on development set:")
print(clf.best_params_)

print("Grid scores on development set:")
means = clf.cv_results_['mean_test_score']
stds = clf.cv_results_['std_test_score']

#THIS IS WHAT YOU WANT
for mean, std, params in zip(means, stds, clf.cv_results_['params']):
    print("%0.3f (+/-%0.03f) for %r"
          % (mean, std * 2, params))
Vivek Kumar
  • 35,217
  • 8
  • 109
  • 132