How to print the LDA topics models from gensim? Python

后端 未结 10 1666
北荒
北荒 2020-12-04 13:42

Using gensim I was able to extract topics from a set of documents in LSA but how do I access the topics generated from the LDA models?

When printing the

10条回答
  •  南笙
    南笙 (楼主)
    2020-12-04 14:05

    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
    ...
    

提交回复
热议问题