负值:评估具有主题一致性的 Gensim LDA

Nil*_*ter 3 evaluation python-3.x gensim topic-modeling

我目前正在尝试使用 gensim topiccoherencemodel 评估我的主题模型:

from gensim.models.coherencemodel import CoherenceModel
cm_u_mass = CoherenceModel(model = model1, corpus = corpus1, coherence = 'u_mass')
coherence_u_mass = cm_u_mass.get_coherence()

print('\nCoherence Score: ', coherence_u_mass)
Run Code Online (Sandbox Code Playgroud)

输出只是负值。这样对吗?任何人都可以提供一个公式或 u_mass 是如何工作的吗?

小智 9

快速浏览一下原始文章,您可以看到 UMass 相干性是根据概率对数计算的,因此它是负数。

关于你问的公式,可以在同一篇文章中找到公式4 。

我明白随着麻省大学连贯性的价值接近 0,主题连贯性变得更好。

希望这可以帮助。

  • 实际上,原始文章是 David Mimno 等人撰写的。[优化主题模型中的语义一致性](https://www.aclweb.org/anthology/D11-1024.pdf) (3认同)