How to print the LDA topics models from gensim? Python

后端 未结 10 1661
北荒
北荒 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:21

    I think syntax of show_topics has changed over time:

    show_topics(num_topics=10, num_words=10, log=False, formatted=True)
    

    For num_topics number of topics, return num_words most significant words (10 words per topic, by default).

    The topics are returned as a list – a list of strings if formatted is True, or a list of (probability, word) 2-tuples if False.

    If log is True, also output this result to log.

    Unlike LSA, there is no natural ordering between the topics in LDA. The returned num_topics <= self.num_topics subset of all topics is therefore arbitrary and may change between two LDA training runs.

提交回复
热议问题