GridSearchCV 最终模型 [英] GridSearchCV final model

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

问题描述

如果我在 scikit-learn 库中使用 GridSearchCV 来寻找最佳模型,它返回的最终模型是什么?也就是说,对于每组超参数,我们训练 CV(例如 3 个)模型的数量.这样,函数是否会返回这 3 个模型中最好的模型以进行最佳参数设置?

If I use GridSearchCV in scikit-learn library to find the best model, what will be the final model it returns? That said, for each set of hyper-parameters, we train the number of CV (say 3) models. In this way, will the function return the best model in those 3 models for the best setting of parameters?

推荐答案

GridSearchCV 将返回一个包含大量信息的对象.它确实返回了在遗漏数据上表现最好的模型:

The GridSearchCV will return an object with quite a lot information. It does return the model that performs the best on the left-out data:

best_estimator_ : 估计器或字典

best_estimator_ : estimator or dict

搜索选择的估算器,即给出的估算器遗漏数据的最高分(或最小损失,如果指定).如果 refit=False 则不可用.

Estimator that was chosen by the search, i.e. estimator which gave highest score (or smallest loss if specified) on the left out data. Not available if refit=False.

请注意,这不是在整个数据上训练的模型.这意味着,一旦您确信这是您想要的模型,您就需要自己在整个数据上重新训练模型.

Note that this is not the model that's trained on the entire data. That means, once you are confident that this is the model you want, you will need to retrain the model on the entire data by yourself.

参考:http://scikit-learn.org/stable/modules/generated/sklearn.model_selection.GridSearchCV.html

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

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