train_data <- sample(seq_len(nrow(completeData)),size = floor(0.75 * nrow(new_data1)))
train <- completeData[train_data, ]
test <- completeData[-train_data, ]
library(dplyr)
data <- select(train,-cardspent)
library(xgboost)
dtrain <- xgb.DMatrix(data = data, label = train$cardspent)
我试图运行此代码但在最后一步之后我收到错误说:
xgb.DMatrix出错(data = data,label = train $ cardspent): xgb.DMatrix:不支持从列表
构造
任何人都可以帮我吗? 或者有更好的代码来运行Xgboost?