python - AttributeError:“XGBClassifier”对象没有属性“_le”
问题描述
我正在尝试在 OOT 数据上拟合我的 xgboost 模型对象(0.60 版本),但不断出错。我正在使用下面的代码行:
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)
然后我得到以下错误(我创建了类似的环境复制模型开发)
class_probs = self.booster().predict(test_dmatrix,output_margin=output_margin,ntree_limit=ntree_limit)
TypeError: 'str' object is not callable
解决方案
推荐阅读
- php - PHP array_unshift 在函数中不起作用
- java - 如何在不知道值的情况下选择硒中的复选框
- r - *平台无关*语言/区域设置?
- c - Oracle 11g:osutil 包;CentOS 7 上没有路径?
- user-interface - 如何在列中的小部件之间有负空间?
- html - 具有多级属性的 CallByName
- oracle - 我拥有的存储过程运行速度非常慢/永远不会完成。有一个更好的方法吗?
- spring-boot - spring boot 客户端应用程序与hashicorp vault 支持的pcf 配置服务器的交互?
- python-3.x - pyspark 中的 df.show() 问题
- dart - Flutter:通过导航加载页面时,Observable.combineLatest2 没有流式传输