GridSearchCV只保存一个估计值

2024-10-06 12:15:31 发布

您现在位置:Python中文网/ 问答频道 /正文

如何只保存一个GridSearchCV估计量?当我使用作业库转储函数,它生成了数百个文件为“最佳估计器”。在

model=cv.best_estimator_
joblib.dump(model, 'model.pkl')

Tags: 文件函数model作业dumpcvbestpkl
1条回答
网友
1楼 · 发布于 2024-10-06 12:15:31

你做的是对的。在

您获得许多.pkl文件的原因是

Note: joblib.dump returns a list of filenames. Each individual numpy array contained in the clf object is serialized as a separate file on the filesystem. All files are required in the same folder when reloading the model with joblib.load.

可以在http://scikit-learn.org/stable/modules/model_persistence.html#persistence-example找到

相关问题 更多 >