I am trying to use the XGBoost model to perform a multi-class classification over 40 classes.
The code is as follows:
xgb_params = list(colsample_bytree= 0.7,
subsample = 0.7,
eta = 0.05,
objective= 'multi:softmax',
max_depth= 5,
min_child_weight= 1,
eval_metric= "mlogloss", num_class = categoryclassnos,
nthread=4)
fit.xgb = xgb.train(params = xgb_params,
data = dtrain,
nrounds = 500,
watchlist = list(train = dtrain, test=dtest),
print_every_n = 50)
However, I am getting the following error:
Check failed: (info.labels.size()) != (0) label set cannot be empty
I have reproduced the dataset and the R script here.
Any help/ pointers are deeply appreciated.
trainlabelsfactored <- as.integer(train$primarydeptt) - 1
return $\endgroup$label
parameter. $\endgroup$