Gensim LDA - Default number of iterations

7.4k views Asked by At

I wish to know the default number of iterations in gensim's LDA (Latent Dirichlet Allocation) algorithm. I don't think the documentation talks about this. (Number of iterations is denoted by the parameter iterations while initializing the LdaModel ). Thanks !

3

There are 3 answers

2
Utsav T On BEST ANSWER

Checked the module's files in the python/Lib/site-packages directory. The constructor is something like this -

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)

So, the default number of iterations stands at 50.

0
ThReSholD On

The default number of iterations = 50

0
User0 On

If you use:

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

It will tell you

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