I'm going to perform xgboost on R using xgb.train
function.
In order to use the xgb.train
function, I know that input data must be transformed as using xgb.DMatrix
function.
But when I used this function in my data setm I got an error message :
Error in xgb.DMatrix(data = as.matrix(train)) :
[09:01:01] amalgamation/../dmlc-core/src/io/local_filesys.cc:66: LocalFileSystem.GetPathInfo 1 Error:No such file or directory
Following is my full R code. To use input data, How to transform input data?
credit<-read.csv("http://freakonometrics.free.fr/german_credit.csv", header=TRUE)
F=c(1,2,4,5,7,8,9,10,11,12,13,15,16,17,18,19,20,21)
for(i in F) credit[,i]=as.factor(credit[,i])
str(credit)
library(caret)
set.seed(1000)
intrain<-createDataPartition(y=credit$Creditability, p=0.7, list=FALSE)
train<-credit[intrain, ]
test<-credit[-intrain, ]
d_train<-xgb.DMatrix(data=as.matrix(train))