且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何从gensim打印LDA主题模型? Python

更新时间:2023-02-27 08:43:17

经过一番混乱之后,ldamodelprint_topics(numoftopics)似乎有一些错误.所以我的解决方法是使用print_topic(topicid):

After some messing around, it seems like print_topics(numoftopics) for the ldamodel has some bug. So my workaround is to use print_topic(topicid):

>>> print lda.print_topics()
None
>>> for i in range(0, lda.num_topics-1):
>>>  print lda.print_topic(i)
0.083*response + 0.083*interface + 0.083*time + 0.083*human + 0.083*user + 0.083*survey + 0.083*computer + 0.083*eps + 0.083*trees + 0.083*system
...