由于目标的形状,我一直在努力让 python 的 xgboost 接受目标(我尝试过 (-1,1) 与 (-1,) 的形状,pandas 与 numpy 的格式,以及 LabelBinarizing 与 One-hot-encoding 目标)。有什么建议可以让这一切顺利进行吗?
import numpy as np
x = np.random.randint(0, 25, size = (1000, 10))
y = np.random.randint(0, 5, size = (1000, 1))
clf = xgb.XGBClassifier()
x = xgb.DMatrix(x)
y = xgb.DMatrix(y)
clf.fit(x, y)
ValueError: bad input shape ()