Reputation: 340
I almost forked this project from GitHub
but in the last script
bst <- xgboost(data = as.matrix(train[,predictorNames]),
label = train$outcome,
verbose = 0,
eta = 0.1,
gamma = 50,
nround = 50,
colsample_bytree = 0.1,
subsample = 8.6,
objective="binary:logistic")
predictions <- predict(bst, as.matrix(test[,predictorNames]), outputmargin=TRUE)
I get this error
Error in xgb.DMatrix(data, label = label, missing = missing) : 'data' has class 'character' and length 1261520. 'data' accepts either a numeric matrix or a single filename.
but I've not been able to fix that. Any help, please?
Upvotes: 1
Views: 672
Reputation: 508
XGBoost cannot accept character data. You have forgotten something that is of character type in there. You need to either remove it or treat it somehow (one hot encoding for example)
Upvotes: 0