Skip to content
Prev 54773 / 63424 Next

sparse.model.matrix Generates Non-Existent Factor Levels if Ord.factor Columns Present

Good day,

The intention is to convert the dataset into a format suitable for the random forest classifier implemented by the CRAN package xgboost. The input data is required to be transformed into one-hot format using the sparse.discrim.matrix function, as specified by the package's vignette of URL https://cran.r-project.org/web/packages/xgboost/vignettes/discoverYourData.html I did not know to read the help page for contr.poly after reading the sparse.discrim.matrix help page. Perhaps there could be a helpful mention added to it?

--------------------------------------
Dario Strbenac
University of Sydney
Camperdown NSW 2050
Australia