这里,best_model_lda 是一个基于 sklearn 的 LDA 模型,我们正在尝试找到该模型的一致性分数。
coherence_model_lda = CoherenceModel(model = best_lda_model,texts=data_vectorized, dictionary=dictionary,coherence='c_v')
coherence_lda = coherence_model_lda.get_coherence()
print('\n Coherence Score :',coherence_lda)
Run Code Online (Sandbox Code Playgroud)
输出:出现此错误是因为我正在尝试查找 sklearn LDA 主题模型的连贯性分数,有没有办法解决它。另外,sklearn LDA 使用什么指标将这些单词分组在一起?
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
~\AppData\Local\Continuum\anaconda3\lib\site-packages\gensim\models\coherencemodel.py in _get_topics_from_model(model, topn)
490 matutils.argsort(topic, topn=topn, reverse=True) for topic in
--> 491 model.get_topics()
492 ]
AttributeError: 'LatentDirichletAllocation' object has no attribute 'get_topics'
During handling of the above exception, another exception occurred:
ValueError Traceback (most recent call last)
<ipython-input-106-ce8558d82330> in <module>
----> 1 coherence_model_lda = CoherenceModel(model = best_lda_model,texts=data_vectorized, …Run Code Online (Sandbox Code Playgroud)