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

标签 python gensim lda topic-modeling

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'

最佳答案

LDA 会为每个主题分配尽可能多的单词,只要它们超过了它的阈值。这意味着一个主题可能有 70 个单词,而另一个主题可能有 200 个单词。您可以通过打印来查看更多单词。试试这个:

model.print_topics(8, 15)

关于python - 如何更改 LdaMulticore 中的默认字数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55815556/

相关文章:

python - Pyinstaller 构建应用程序后设计变得丑陋

Python Numpy 向量化组合学的嵌套 for 循环

python - gensim安装的问题

python-3.x - 如何使用word2vec进行文本分类

ruby - 无法概念化如何让 LDA-Ruby 读取多个 .txt 文件

machine-learning - 在 LDA 中应用 fit_transform 时输入形状错误

python - 如何在Python中使用Selenium上传选定的文件?

python - 扩建部署策略

python - 使用源代码和 pip 安装 Gensim 很困难