python - GridSearchCV最终模型

标签 python machine-learning scikit-learn

如果我在 scikit-learn 库中使用 GridSearchCV 来查找最佳模型,它返回的最终模型是什么?也就是说,对于每组超参数,我们训练一定数量的 CV(比如 3 个)模型。这样,函数会返回这3个模型中最好的模型来获得最佳的参数设置吗?

最佳答案

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

best_estimator_ : estimator or dict

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.

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

引用号:http://scikit-learn.org/stable/modules/generated/sklearn.model_selection.GridSearchCV.html

关于python - GridSearchCV最终模型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49455806/

相关文章:

python - 使用 Python 进行异常检测

machine-learning - 如何进行 NLP 任务来识别意图和槽位

machine-learning - 非二元决策树到二元决策树(机器学习)

scikit-learn - 在 scikit-learn 中进行详尽的特征选择?

python-2.7 - 拟合后如何从sklearn GMM中的每个组件获得标准偏差

python - 如何在Python中设置临时目录路径?

python - Python 或 Ruby 适合渗透测试吗?

python - 高斯混合模型 (GMM) 拟合不佳

python - Odoo:如何处理对话中附加的winmail.dat?

python - 将 numba 函数拆分为项目中的单独模块以进行打包