Gensim LDA - 默认迭代次数

4

我想知道gensim的LDA (Latent Dirichlet Allocation)算法中默认迭代次数。我认为文档中没有提到这一点。(迭代次数由参数iterations在初始化LdaModel时表示)。谢谢!

3个回答

7

检查位于 python/Lib/site-packages 目录中的模块文件。构造函数大致如下 -

def __init__(self, corpus=None, num_topics=100, id2word=None,
                 distributed=False, chunksize=2000, passes=1, update_every=1,
                 alpha='symmetric', eta=None, decay=0.5, offset=1.0,
                 eval_every=10, iterations=50, gamma_threshold=0.001)

因此,默认迭代次数为50。

“passes”和“iterations”的区别是什么? - BlackSwan
1
一点点谷歌搜索 -passes参数确实是gensim独有的。它本质上允许LDA多次查看您的语料库,并且对于较小的语料库非常方便。iterations参数限制了LDA为每个文档执行E-Step的次数(请参见算法2中的重复直到循环https://www.cs.princeton.edu/~blei/papers/HoffmanBleiBach2010b.pdf),这意味着某些文档可能无法及时收敛。您可以将其设置得尽可能高(或有时间)。链接:http://thread.gmane.org/gmane.comp.ai.gensim/4732 - Utsav T

1
如果你使用:

import logging
logging.basicConfig(format='%(asctime)s : %(levelname)s : %(message)s', 
    level=logging.INFO)

它会告诉你。
running batch LDA training, 17 topics, 10 passes over the supplied corpus of 1130 documents, updating model once every 1130 documents, evaluating perplexity every 1130 documents, iterating 50x with a convergence threshold of 0.001000

0

默认迭代次数为50


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接