0

I have a R matrix mat and I want to perform LDA on it.

When I run lda_model$fit_transform(mat, n_iter = 20), I get an error:

Error in super$check_convert_input(x) : 
 don't know how to deal with input of class 'matrix'

Is there an easy way to solve this? The source for my matrix is not text and I don't want to go into vocabularies, itoken(), etc.

tomaz
  • 493
  • 4
  • 13

1 Answers1

0

Casting to sparseMatrix before fitting the model seems to do the trick:

library(Matrix)
mat <- as(mat, "sparseMatrix")
tomaz
  • 493
  • 4
  • 13