Skip to content
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

predict errors for textmodel_lsa(dfmt, margin = "features") #54

Open
koheiw opened this issue May 20, 2022 · 0 comments
Open

predict errors for textmodel_lsa(dfmt, margin = "features") #54

koheiw opened this issue May 20, 2022 · 0 comments

Comments

@koheiw
Copy link
Collaborator

koheiw commented May 20, 2022

require(quanteda)
#> Loading required package: quanteda
#> Warning in .recacheSubclasses(def@className, def, env): undefined subclass
#> "packedMatrix" of class "replValueSp"; definition not updated
#> Warning in .recacheSubclasses(def@className, def, env): undefined subclass
#> "packedMatrix" of class "mMatrix"; definition not updated
#> Package version: 3.2.1
#> Unicode version: 13.0
#> ICU version: 69.1
#> Parallel computing: 8 of 8 threads used.
#> See https://quanteda.io for tutorials and examples.
require(quanteda.textmodels)
#> Loading required package: quanteda.textmodels

toks <- tokens(data_corpus_inaugural)
dfmt <- dfm(toks)

lsa1 <- textmodel_lsa(dfmt, margin = "document")
pred1 <- predict(lsa1)

lsa2 <- textmodel_lsa(dfmt, margin = "features")
pred2 <- predict(lsa2)
#> Error in newdata %*% object$features: not-yet-implemented method for <dgCMatrix> %*% <NULL>

Created on 2022-05-20 by the reprex package (v2.0.1)

I think $features should be $docs for margin = "features".

tsa <- newdata %*% object$features %*% solve(diag(object$sk))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant