Utsav T
Utsav T

Reputation: 1545

Gensim LDA - Default number of iterations

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 !

Upvotes: 5

Views: 7737

Answers (3)

ThReSholD
ThReSholD

Reputation: 698

The default number of iterations = 50

Upvotes: 0

Sam Weisenthal
Sam Weisenthal

Reputation: 2951

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

Upvotes: 1

Utsav T
Utsav T

Reputation: 1545

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.

Upvotes: 8

Related Questions