获取GridSearchCV的标准差 [英] Get standard deviation for a GridSearchCV

查看:202
本文介绍了获取GridSearchCV的标准差的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在scikit学习0.20之前,我们可以使用 result.grid_scores_ [result.best_index _] 来获取标准偏差。 (例如:平均值:0.76172,标准:0.05225,参数:{'n_neighbors':21}

Before scikit-learn 0.20 we could use result.grid_scores_[result.best_index_] to get the standard deviation. (It returned for exemple: mean: 0.76172, std: 0.05225, params: {'n_neighbors': 21})

在scikit-learn 0.20中获得最佳分数的标准偏差的最佳方法是什么?

What's the best way in scikit-learn 0.20 to get the standard deviation of the best score ?

推荐答案

在较新的版本中, grid_scores _ 重命名为 cv_results _ 。遵循文档,您需要以下内容:

In newer versions, the grid_scores_ is renamed as cv_results_. Following the documentation, you need this:


best_index_ : int

The index (of the cv_results_ arrays) which corresponds to the best > 
  candidate parameter setting.

The dict at search.cv_results_['params'][search.best_index_] gives the > 
  parameter setting for the best model, that gives the highest mean
  score (search.best_score_).


因此,在您的情况下,您需要

So in your case, you need


  • 最佳参数:- result.cv_results _ ['params'] [result.best_index _] result.best_params _

  • 最高平均得分:- result.cv_results _ ['mean_test_score'] [result.best_index_ ] result.best_score _

最佳std:- result.cv_results _ ['std_test_score'] [result.best_index _]

这篇关于获取GridSearchCV的标准差的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆