m.khalil
m.khalil

Reputation: 81

Is there any way to match Gensim LDA output with topics in pyLDAvis graph?

I need to process the topics in the LDA output (lda.show_topics(num_topics=-1, num_words=100...) and then compare what I do with the pyLDAvis graph but the topic numbers are differently numbered. Is there a way I can match them?

Upvotes: 8

Views: 1794

Answers (1)

formi23
formi23

Reputation: 636

If it's still relevant, have a look at the documentation http://pyldavis.readthedocs.io/en/latest/modules/API.html

You may want to set sort_topics to False. This way the order of topics in gensim and pyLDAvis will be the same.

At the same time, gensim's indexing starts from 0, while pyLDAvis displays topics starting from 1. Not sure if there's a straightforward way to address this.

Upvotes: 8

Related Questions