【发布时间】:2019-01-30 04:05:32
【问题描述】:
我创建了一个 XGBoost 分类器,并使用 joblib 以 dat 文件格式转储了 python 文件。
我可以使用 joblib 加载它,但是当我尝试使用加载的模型来预测新数据时,我看到了错误
xgboost.core.XGBoostError: need to call fit beforehand
我训练的原始模型是:
XGBClassifier(base_score=0.5, booster='gbtree', colsample_bylevel=1,
colsample_bytree=0.6, eval_metric='error', gamma=0,
learning_rate=0.125, max_delta_step=0, max_depth=8,
min_child_weight=1, missing=None, n_estimators=600, n_jobs=1,
nthread=None, objective='binary:logistic', random_state=0,
reg_alpha=0.2, reg_lambda=0.8, scale_pos_weight=1, seed=None,
silent=True, subsample=0.8)
腌制模型是:
XGBClassifier(base_score=0.5, booster='gbtree', colsample_bylevel=1,
colsample_bytree=1, gamma=0, learning_rate=0.1, max_delta_step=0,
max_depth=3, min_child_weight=1, missing=None, n_estimators=100,
n_jobs=1, nthread=None, objective='binary:logistic',random_state=0,
reg_alpha=0, reg_lambda=1, scale_pos_weight=1, seed=None,
silent=True, subsample=1)
错误的任何原因以及为什么尽管我保存和加载相同的模型但两者都不同?
【问题讨论】:
-
您能否提供您的代码 sn-ps 适合和腌制模型的位置,然后加载和预测的位置?仅仅看到模型并不能真正帮助诊断任何事情