Closed kbenoit closed 5 years ago
I've updated predict.textmodel_nnseq so that it works similarly to predict.textmodel_svm. I should note that the keras model generates an error when newdata is input as the matrix.csr.dfm type. Currently, newdata is converted to a dfm and that is used to make predictions without issue. I'll keep working to figure out what is preventing as.matrix.csr.dfm from being recognized by the keras model.
That's because the matrix.csr
is a format for the SparseM package that is only required by the library that fits the linear SVM. The matrix.csr
is not applicable for the new function.
If you check the input format for the keras sequential model, it's just a regular matrix. So (unfortunately) we will need to coerce the dfm to a dense matrix it using as.matrix()
.
predict.textmodel_slstm()
needs to output predictions in a similar format topredict.textmodel_svm()
(and the other quanteda textmodel functions).