You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
I used to have a previous version of LDAvis (2014) installed with devtools.
In the version I had of LDAvis I would call createJSON as:
json <- createJSON(K, phi, term.frequency, vocab, topic.proportions)
Today I updated my R packages and have a newer vesion of LDAvis (from CRAN) which uses createJSON as:
json <- createJSON(phi, theta, doc.length, vocab, term.frequency)
I'm using MALLET for the LDA. I can easily access to the phi and theta matrices as well as the vocab and term.frequency but not so much to doc.length.
According to the doc of LDAvis it's a vector containing the number of tokens in each document of the corpus.
Question: how can I construct such vector from a MALLET instance (mallet.import)?
Thanks!
G.
The text was updated successfully, but these errors were encountered:
just figured out that you can compute it yourself. Here is my take
doc.tokens<-data.frame(id=c(1:nrow(doc.topics)), tokens=0)
for(iinvocab){
# Find word if word in textmatched<- grepl(i,docs$text)
doc.tokens[matched,2] =doc.tokens[matched,2] +1
}
Hi,
I used to have a previous version of LDAvis (2014) installed with devtools.
In the version I had of LDAvis I would call createJSON as:
json <- createJSON(K, phi, term.frequency, vocab, topic.proportions)
Today I updated my R packages and have a newer vesion of LDAvis (from CRAN) which uses createJSON as:
json <- createJSON(phi, theta, doc.length, vocab, term.frequency)
I'm using MALLET for the LDA. I can easily access to the phi and theta matrices as well as the vocab and term.frequency but not so much to doc.length.
According to the doc of LDAvis it's a vector containing the number of tokens in each document of the corpus.
Question: how can I construct such vector from a MALLET instance (mallet.import)?
Thanks!
G.
The text was updated successfully, but these errors were encountered: