运行Xgboost时出错

时间:2016-12-11 14:20:22

标签: r machine-learning xgboost

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?

1 个答案:

答案 0 :(得分:1)

这可能对您有所帮助

?xgb.DMatrix

xgb.DMatrix