我是XGBoost的新手,我想使用train()函数,但是当我尝试使用它时,会出现以下错误
146 else:
147 try:
148 main()
149 except KeyboardInterrupt:
150 print("KeyboardInterrupt, exiting")
/usr/local/lib/python3.6/dist-packages/xgboost/core.py in __init__(self, params, cache, model_file)
938 for d in cache:
939 if not isinstance(d, DMatrix):
940 raise TypeError('invalid cache item: {}'.format(type(d).__name__))
941 self._validate_features(d)
942
TypeError: invalid cache item: DataFrame
我的代码是
import xgboost as xgb
xgb_params = {
"objective": "multi:softmax",
"eta": 0.3,
"num_class": 62,
"max_depth": 10,
"nthread": 4,
"eval_metric": "merror",
"print.every.n": 1
#"silent": 1
}
clf = xgb.train(params=xgb_params, dtrain=df, num_boost_round=10)
XGB要求您将数据帧转换为数据矩阵,以便进行处理
相关问题 更多 >
编程相关推荐