如何更改LdaMulticore中的默认字数?

问题描述 投票:0回答:1

默认情况下,LDA在主题中显示10个单词。我希望将这些数字增加15.我尝试过“topn”和“num_words”关键字,但两者都给了我一个错误。如何更改此默认行为?

model = models.LdaMulticore(corpus=corpus, id2word=dictionary, num_topics=8,topn=15,chunksize=10000, passes=30,iterations=300)

错误是

    model = models.LdaMulticore(corpus=corpus, id2word=dictionary, num_topics=8,topn=15,chunksize=10000, passes=30,iterations=300)
TypeError: __init__() got an unexpected keyword argument 'topn'
python gensim lda topic-modeling
1个回答
0
投票

只要LDA超过其阈值,LDA就会按其认为合适的方式为每个主题分配尽可能多的单词。这意味着一个主题可能有70个单词,另一个主题可能有200个。您可以通过打印来查看更多单词。试试这个:

model.print_topics(8, 15)
© www.soinside.com 2019 - 2024. All rights reserved.