-
Notifications
You must be signed in to change notification settings - Fork 636
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 in caret #474
Comments
Some of that model code was written a decade ago; if a model now allows for a sparse matrix, let me know or do a PR. Thanks, Max |
Thanks Max. One that comes to mind is Ranger. I think it can take a sparse matrix for x but from what I can tell from fit method in caret it gets converted to data frame. I 'm not quite sure but I think nnet can also accept a matrix but it gets converted to data frame in caret. XGBoost and glmnet are ones that I'm using right now and both support sparse matrix. FR |
I take that back I don't think ranger supports matrix. |
The In Test away! |
Thank you for speedy response. I noticed line 56 in glmnet.R may not be correct. It says 'x <- as.matri(x)' and should be x <- as. matrix(x). FR |
Thanks |
I think one more change is needed:
should be
|
I'm not sure.
It needs to be a matrix of some sort and I interpret the above to mean either "matrix" or "sparseMatrix" |
I am trying to use a I've tried to fix it in my local branch: The first issue is at the line I've change the code to set The second problem - if x is
I've replaced it to:
Now it works but I have a warning from the main train.default function :
May be you have any idea what's wrong? |
Sorry for the delay. I think that it is the Also, I just fixed a few things in the devel version related to sparse matrices so try reinstall thing that too. There are some inherent limitations to some of these sparse classes. A lot of existing code needs a data frame or matrix (say for prepreocessing or subsampling) and there are not methods for these sparse matrix classes to accommodate them. |
Setting |
It is possible to use sparse matrix with caret? All the code that I've seen in caret uses as.matrix(x) which converts it to a dense matrix (as it was pointed out to me on stack overflow). This sort of defeats the purpose of using a sparse matrix.
TIA,
FR
The text was updated successfully, but these errors were encountered: