xgboost: error in setting the xgb.DMatrix in R

I'm trying to set up a xgboost model and a piece of my code is:

dtrain <- xgb.DMatrix(data = new_tr,label = labels) 
dtest <- xgb.DMatrix(data = new_ts,label=labels_test)

but I have this error:

> dtrain <- xgb.DMatrix(data = new_tr,label = labels) 
Error in setinfo.xgb.DMatrix(dmat, names(p), p[[1]]) : 
  The length of labels must equal to the number of rows in the input data

the lenght of my data are:
image
Someone can help me to find what is the problem?

multidimensional labels ?
1:2382 on one axis
1:6 on another

seems wrong, not sure how you got there....

I think it expects labels and labels_test to be vectors.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.