3 thoughts on “Simple LDA Topic Modeling in Python: implementation and visualization, without delve into the Math”

The topic numbers in the graph are not the same as the numbers in the gensim output! is there any way to solve this?

Will be same! the model outputs 10 topic and the graph visualizes 10. you can control how many topics the model will generate by passing num_topics= to LDA() when training the model. Yet you can print out less than 10 topics(when training the model, pass num_topics =10), calling the method model.print_topics(num_topics=5, num_words=10), so the model will show you 5 topics rather than 10.

Could you explain how to implement those pyLDAvis interactive visualization in HTML/JavaScript? 🙂

The topic numbers in the graph are not the same as the numbers in the gensim output! is there any way to solve this?

Will be same! the model outputs 10 topic and the graph visualizes 10. you can control how many topics the model will generate by passing num_topics= to LDA() when training the model. Yet you can print out less than 10 topics(when training the model, pass num_topics =10), calling the method model.print_topics(num_topics=5, num_words=10), so the model will show you 5 topics rather than 10.

Could you explain how to implement those pyLDAvis interactive visualization in HTML/JavaScript? 🙂