GridSearchCV 最终模型

编程入门 行业动态 更新时间:2024-10-07 18:23:06
本文介绍了GridSearchCV 最终模型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

如果我在 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/stable/modules/generated/sklearn.model_selection.GridSearchCV.html

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

更多推荐

[db:关键词]

本文发布于:2023-03-31 22:25:47,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/815306.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:模型   GridSearchCV

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!