I use the xgboost
function in R, and I get the following error message
bst <- xgboost(data = germanvar, label = train$Creditability, max.depth = 2, eta = 1,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.
Following is my full code.
credit<-read.csv("http://freakonometrics.free.fr/german_credit.csv", header=TRUE)
library(caret)
set.seed(1000)
intrain<-createDataPartition(y=credit$Creditability, p=0.7, list=FALSE)
train<-credit[intrain, ]
test<-credit[-intrain, ]
germanvar<-train[,2:21]
str(germanvar)
bst <- xgboost(data = germanvar, label = train$Creditability, max.depth = 2, eta = 1,
nround = 2, objective = "binary:logistic")
Data has a mixture of continuous and categorical variables.
However, because of the error message that only continuous variables can be used, all the variables were recognized as continuous, but the error message reappears.
How can I solve this problem???