Wednesday, January 13, 2016

XGBoost in R. Error in xgb.DMatrix and can not open file -unknown- and Error in xgb.DMatrix

XGBoost in R. Error in xgb.DMatrix and can not open file -unknown- and Error in xgb.DMatrix

XGBoost in R

Preparing data model for XGBoost
Error in xgb.DMatrix(data, label = label) : can not open file "-unknown-"

Solution

Check if your data has character or factor variables and try to convert them to numerical.

str(Data)

Predict using XGBoost model
red <- predict(bst, xTest)

Error in xgb.DMatrix(newdata) : xgb.DMatrix: does not support to construct from list

Solution

convert the test data into matrix type which is accpected by xgboost

pred <- predict(bst, as.matrix(xTest))

dummyVars function allows us to create dummy variables
in other words it translates text data into numerical data

dummyVars("~ gender", data = df_all)

Error: could not find function "dummyVars"

Solution


library(caret)

Related posts :

XGBoost in R : Error in xgb.iter.update

code of conduct : Top 9 Rule of Data Science Professional

No comments: