I want to get the topic coherence for the LDA model. Let's say I have two LDA model one with a bag of words and the second one with a bag of phrases. how I can get the coherence for these two models and then compare them on the basis of coherence?
Asked
Active
Viewed 387 times
-1
-
1Please add more information. Which programming language and what packages or tools are you using? Are these models of the same dataset? Also, please add what you mean precisely by "bag of phrases" - is everything a phrase exclusively or have you simply added bigrams & trigrams? This will be helpful in finding an answer to your question. Generally, you can compare the two coherence scores - the one that is higher is easier to understand for humans. – jhl Apr 16 '19 at 14:20
1 Answers
0
For two separate models you can just check coherence separately. You should post some code but this is how to check coherence:
# Compute Coherence Score
coherence_model_ldamallet = CoherenceModel(model=ldamallet, texts=processed_docs, dictionary=dictionary, coherence='c_v')
coherence_ldamallet = coherence_model_ldamallet.get_coherence()
print('\nCoherence Score: ', coherence_ldamallet)
If you want a comparison check out the elbow method for optimizing coherence: 17 I hope this helps

Sara
- 1,162
- 1
- 8
- 21