【发布时间】:2020-02-16 08:03:17
【问题描述】:
我创建了一个 Gensim LDA 模型,如本教程所示:https://www.machinelearningplus.com/nlp/topic-modeling-gensim-python/
lda_model = gensim.models.LdaMulticore(data_df['bow_corpus'], num_topics=10, id2word=dictionary, random_state=100, chunksize=100, passes=10, per_word_topics=True)
它会生成 10 个主题,其 log_perplexity 为:
lda_model.log_perplexity(data_df['bow_corpus']) = -5.325966117835991
但是当我在其上运行一致性模型来计算一致性分数时,如下所示:
coherence_model_lda = CoherenceModel(model=lda_model, texts=data_df['bow_corpus'].tolist(), dictionary=dictionary, coherence='c_v')
with np.errstate(invalid='ignore'):
lda_score = coherence_model_lda.get_coherence()
我的 LDA 分数是 nan。我在这里做错了什么?
【问题讨论】:
标签: python machine-learning gensim lda topic-modeling