-
Notifications
You must be signed in to change notification settings - Fork 635
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sparse 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.frame The 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_features
is a dgCMatrix)The text was updated successfully, but these errors were encountered: