I have a data frame, and I am only interested in the numerical variables (variable class is double):
Example
A B C D E
0.13 2.22 3.44 3.30 6.54
3.55 4.23 0.43 5.33 3.55
...
I want to build a linear regression xgboost model, so I converted the data frame to a dense matrix.
I took out all categorical variables from my data, and am left with the five variables of interest. But I can't seem to be able to use the dense matrix, despite it being a type of input that xgboost accepts. See here. I am instead getting this error:
Error
"Error in xgb.DMatrix(train_mat[, -n], label = train_mat[, n]) : [23:57:13] amalgamation/../dmlc-core/src/io/local_filesys.cc:66: LocalFileSystem.GetPathInfo 2007 Error:No such file or directory".
Code
train_mat <- as.matrix(subset(train, select = -c(Genre, Publisher, Rank, Name, Platform)))
lm.boosted <- xgb.train(data = train_mat, booster= "gblinear", max_depth=3, nthread=1, nrounds = 2, eval_metric="error", eval_metric= "rmse", objective= "reg:linear")
I tried to convert to a xgb.DMatrix, but I am not clear on what it's asking for to do the conversion.
train_mat <- xgb.DMatrix(data = train_mat, label= train$Global_Sales)
How do I input data into xgboost?