【发布时间】:2020-02-27 06:21:20
【问题描述】:
我正在使用 Gensim 训练一个 LDA 模型:
dictionary = corpora.Dictionary(section_2_sentence_df['Tokenized_Sentence'].tolist())
dictionary.filter_extremes(no_below=20, no_above=0.7)
corpus = [dictionary.doc2bow(text) for text in (section_2_sentence_df['Tokenized_Sentence'].tolist())]
num_topics = 15
passes = 200
chunksize = 100
lda_sentence_model = gensim.models.ldamulticore.LdaMulticore(corpus, num_topics=num_topics,
id2word=dictionary,
passes=passes,
chunksize=chunksize,
random_state=100,
workers = 3)
培训后,我需要进一步分析的主题。不幸的是,show_topics 函数只返回 10 个主题。我预计 15 个主题的定义数量。有谁知道这是故意的还是可以解决的错误?
print(len(lda_sentence_model.show_topics(formatted=False)))
【问题讨论】: