Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upSparse matrix (dgCMatrix) used with xgboost giving errors in train() #593
Comments
|
It would help to have a small reproducible example (the issues template is there for a reason). Also, you should have seen warnings about The main problem is that you are using up-sampling. > class(x)
[1] "xgb.DMatrix"
> as.matrix(x)
Error in as.vector(x, mode) :
cannot coerce type 'externalptr' to vector of type 'any'
> as.data.frame(x)
Error in as.data.frame.default(x) :
cannot coerce class ""xgb.DMatrix"" to a data.frameThe proper solution is to make classes for each of the sampling techniques and create methods for each data type (matrix, data frames, and sparse matrices). SMOTE and ROSE will have the same issue. That will take a little time and won't be in the imminent release. There are a few other small issues that I'll fix in the short term. |
|
This should be fixed now in the devel version and the one that I just sent to CRAN. But please test and reopen if you find any problems |
Using caret version 6.0-73, xgboost version 0.6-4.
I have a dgCMatrix that I'm using in the x argument for train(). I'm getting errors like this:
I also tried to convert the matrix myself to an xdb.DMatrix (
dmatrix <- xgb.DMatrix(train_text_features)) but when I do that then I get this error during training:am I doing something wrong or is there a bug?
My code looks like this (
train_text_featuresis a dgCMatrix)