Calculating topic distribution of an unseen document on GenSim

雨燕双飞 提交于 2020-02-22 08:48:48

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!