我正在尝试将我的xgboost模型对象(0.60版本)适合OOT数据,但始终会出错。我正在使用以下代码行:
fname = "xgb"
if isinstance(xgb, XGBClassifier):
regressor = XGBClassifier()
r = pickle.load(open(fname, "rb" ))
print(r)
regressor._Booster = r._Booster
regressor.set_params(**r.get_xgb_params())
y_predict = regressor.predict(oot)
错误:
AttributeError: 'XGBClassifier' object has no attribute '_le'
我还尝试使用其他方式对OOT数据评分:
scored = scored_data.predict(oot)
然后我遇到错误(我创建了类似的环境复制模型dev)
class_probs = self.booster().predict(test_dmatrix,output_margin=output_margin,ntree_limit=ntree_limit)
TypeError: 'str' object is not callable