AttributeError: 'GridSearchCV' object has no attribute 'grid_scores_'

 网上查到原因是sklearn旧版本有'grid_scores_',而新版本改成了'cv_results_'

 

在此罗列其输出的两种版本形式:

旧版本

for params, mean_score, scores in grid_result.grid_scores_: 
    print("%f (%f) with: %r" % (scores.mean(), scores.std(), params))

新版本 

means = grid_result.cv_results_['mean_test_score']
params = grid_result.cv_results_['params']
for mean,param in zip(means,params):
    print("%f  with:   %r" % (mean,param))

 

你可能感兴趣的:(debug之路)