Search code examples
rmachine-learningsparse-matrixr-caretglmnet

Can I use glmnet with caret and sparse matrices?


One of the big perks to using glmnet for me is the ability to work with sparse matrices directly without having to convert them. Posts here seem to indicate that caret's train function can only take in data frames for the training set, and ?caret::train suggests the same. Is this actually the case?


Solution

  • That was definitely true in the past and, currently, the predictor data will be converted to a data frame. However, some recent changes to the package would probably allow for sparse matrix objects to be maintained.

    I added this and will look into it.

    Max