user3778289
user3778289

Reputation: 323

How to change the default number of words in LdaMulticore?

LDA shows 10 number of words in a topic by default. I want to increase these numbers by 15. I have tried "topn" and "num_words" keywords but both are giving me an error. how can I change this default behaviour?

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

Error is

    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'

Upvotes: 2

Views: 718

Answers (1)

Sara
Sara

Reputation: 1202

LDAs allocate as many words per topic as it sees fit so long as they pass its' threshold. That means one topic might have 70 words where another could have 200. You can view more words by printing them. Try this:

model.print_topics(8, 15)

Upvotes: 2

Related Questions