问题
I am trying to use LDA module of GenSim to do the following task
"Train a LDA model with one big document and keep track of 10 latent topics. Given a new, unseen document, predict probability distribution of 10 latent topics".
As per tutorial here: http://radimrehurek.com/gensim/tut2.html, this seems possible for a document in a corpus, but I am wondering if it it would be possible for an unseen document.
Thank you!
回答1:
From the documentation you posted it looks like you can train your model like this:
>>> model = models.LdaModel(corpus, id2word=dictionary, num_topics=100)
And then from this page it looks like you can apply your model on "an unseen document" like this:
>>> doc_lda = model[doc_bow]
Where doc_bow
is a bag-of-words generated by the doc2bow tool.
来源:https://stackoverflow.com/questions/40924185/calculating-topic-distribution-of-an-unseen-document-on-gensim