Hackr.io is hiring Technical Content Writers (Freelance / Full-Time)

Python Discussion Forums

There's no such thing as a stupid question. Ask. Discuss. Learn.

How to plot a document topic distribution in structural topic modeling R-package?

If I am using python Sklearn for LDA topic modeling, I can use the Python transform function to get a "document topic distribution" of the LDA-results like here:

document_topic_distribution = lda_model.transform(document_term_matrix)
Now I tried also the R structural topic models (stm) package and i want get the same. Is there any function in the stm package, which can produce the same thing (document topic distribution)? I have the stm-object created as follows:

stm_model <- stm(documents = out$documents, vocab = out$vocab,
K = number_of_topics, data = out$meta,
max.em.its = 75, init.type = "Spectral" )
But i didn't find out how I can get the desired distribution out of this object. The documentation didn't really help me aswell.

Azharuddin 8 months ago
  • Whitelisted Links