Sparse matrix in CSC format dgCMatrix in LiblineaR occurs error [R]

190 views Asked by At

dtm_train_tfidf is a sparse matrix in CSC format dgCMatrix

I am using the function LiblineaR which is supposed to accept sparse matrices. However when I use the sparse matrix dtm_train_tfidf, the following error occurs:

 library(LiblineaR)

 LiblineaR(data=dtm_train_tfidf,
 target=train$setiment, type = 4, cost = 1, epsilon = 0.1,
 +           svr_eps = NULL, bias = 1, cross = 0, verbose = FALSE,
 +           findC = FALSE)

 Error in t.default(data) : argument is not a matrix
1

There are 1 answers

1
Dmitriy Selivanov On BEST ANSWER

LiblineaR relies on SparseM package which is not mainstream now-days for sparse matrices in R. You can check here on how convert dgCMatrix to "matrix.csc" from SparseM.