主题建模潜在狄利克雷分配(LDA)

时间:2019-01-06 10:42:52

标签: lda

我是NLP概念的新手,并且一直在尝试理解主题建模。在下面的潜在狄利克雷分配(LDA)代码中,我很困惑 print_topics 做什么?

doc1 = "Sugar is bad to consume.  My bad sister likes  have sugar, but bad not my father." 
doc_complete = [doc1]  
doc_clean = [doc.split() for doc in doc_complete]
import gensim 
from gensim import corpora
dictionary = corpora.Dictionary(doc_clean)
doc_term_matrix = [dictionary.doc2bow(doc) for doc in doc_clean]
Lda = gensim.models.ldamodel.LdaModel
ldamodel = Lda(doc_term_matrix, num_topics=2,  passes=50)
print(ldamodel.print_topics())

output-: [(0, '0.152*"2" + 0.065*"13" + 0.065*"12" + 0.065*"4" + 0.065*"7" 
    + 0.065*"0" + 0.065*"1" + 0.065*"3" + 0.065*"5" + 0.065*"10"'), 
(1, '0.071*"2"     + 0.071*"9" + 0.071*"8" + 0.071*"6" + 0.071*"11" + 0.071*"10" + 0.071*"7" +   0.071*"3" + 0.071*"0" + 0.071*"1"')]

我已经看到了与此相关的一些问题,但是我仍然不清楚。

0 个答案:

没有答案