1
$\begingroup$

I am using the lda package in R (documentation pdf) for its Relational Topic Modeling functionality. The package enables you to determine topic assignments and document links (mainly what I am interested in) for the training set of documents and lets you determine links between documents as well. However, it does not appear to let you determine topic distributions on unseen documents with the trained RTM model. I know that there are ways to do this with different LDA packages and software (MALLET, topicmodels, etc.), but none that I can find with RTM. I am primarily interested in determining new links.

Can someone please explain how to use a trained RTM model to predict the topic distributions on an unseen document? Blei mentioned it very briefly in the paper below in the section about prediction (in section 3), but I am unable to understand / implement it.

Here is the original paper:

  • Chang, J, & Blei, DM. Relational Topic Models for Document Networks. Proceedings of the 12th International Conference on Artificial Intelligence and Statistics (AISTATS) 2009, Clearwater Beach, Florida, USA. Volume 5 of JMLR: W&CP 5 (pdf)
$\endgroup$
4
  • $\begingroup$ If you are only asking how to use R / this package, that would be off topic here. If you have a question about topic models per se, please edit to clarify. $\endgroup$ Commented Jul 3, 2016 at 22:38
  • $\begingroup$ Hi, I mean to ask whether or not there exists a topic model package that allows you to infer new topic distributions given a trained RTM. If that is also off-topic, where should I post it? $\endgroup$ Commented Jul 3, 2016 at 22:41
  • $\begingroup$ You could ask here about how to infer new topic distributions given a trained RTM. If you just want to ask for a package, that would be off topic. You could try on the r-help listserv. $\endgroup$ Commented Jul 3, 2016 at 22:43
  • $\begingroup$ OK, I retracted my close vote. $\endgroup$ Commented Jul 3, 2016 at 22:55

1 Answer 1

1
$\begingroup$

For those in the future who may be interested in this question, I have found a script that appears to be compatible with the output from the R LDA library here. It gives the topic distributions based on the output of a trained RTM.

Edit:

After contacting the author of the "lda" library in R (Jonathan Chang), another approach (in addition to the python function) is:

call lda.collapsed.gibbs.sampler on your test documents, setting freeze.topics=TRUE and initial = list(topics = model\$topics, topic_sums = model\$topic_sums), where model is the result of the RTM run. The resulting document_sums will give you the (unnormalized) distribution over topics for the test documents. Normalize them, and compute the inner product, weighted by the RTM coefficients to get the predicted link probability (or use predictive.link.probability)

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.