把XGBRegressor保存到本地文件并调用

  统计/机器学习 Python I/O    浏览次数:6557        分享
0

我在python中train了一个XGBRegressor,怎么把它保存为本地文件,并且再调用呢?

 

luzehao   2018-07-13 11:00



   1个回答 
3

这个和保存sklearn的模型是一样的

#训练
model = XGBRegressor()
model.fit(X, y)

#保存
from sklearn.externals import joblib
joblib.dump(model, 'my_xgbregressor.pkl')

#读取
model = joblib.load('my_xgbregressor.pkl')


SofaSofa数据科学社区DS面试题库 DS面经

chrisliang   2018-07-16 09:04



  相关讨论

xgboost的sklearn接口有n_estimators参数,xgboost原始接口没有这个参数?

python里XGBClassifier怎么设置early stop?

XGBClassifier设置random_state报错

XGBClassifier和XGBRegressor里的base_score有什么用?

xgboost可以用sklearn里的GridSearchCV吗?

xgboost的FIT问题

xgboost中的参数min_child_weight是什么意思?

sklearn的模型如何保存下来?

xgboost展开到二阶导数有什么好处啊

xgboost怎么调参?

  随便看看

逻辑回归模型中变量的系数怎么理解?

向量梯度下降优化的最佳步长?

随机森林(random forest)和支持向量机(SVM)各有什么优劣

numpy array里怎么用fillna填充nan的值?

seaborn.distplot直方图的y轴的数值是什么意思?