我对 R 很陌生,并且在使用 XGBoost 功能时遇到了一些问题。这是我到目前为止的代码:
test_rows <- sample.int(nrow(ccdata), nrow(ccdata)/3)
test <- ccdata[test_rows,]
train <- ccdata[-test_rows,]
table(test$default.payment.next.month)
table(train$default.payment.next.month)
bstSparse <- xgboost(data = train, label = train$default.payment.next.month, max.depth = 2, eta = 1, nthread = 2, nround = 2, objective = "binary:logistic")
我收到以下错误:
Error in xgb.get.DMatrix(data, label, missing, weight) :
xgboost only support numerical matrix input,
use 'data.matrix' to transform the data.
In addition: Warning message:
In xgb.get.DMatrix(data, label, missing, weight) :
xgboost: label will be ignored.
如果有人有任何建议,将不胜感激。
非常感谢