Skip to content

Instantly share code, notes, and snippets.

@techykajal
Created August 28, 2021 13:38
Show Gist options
  • Select an option

  • Save techykajal/3a8af7b97201294de874b73dfb90e5de to your computer and use it in GitHub Desktop.

Select an option

Save techykajal/3a8af7b97201294de874b73dfb90e5de to your computer and use it in GitHub Desktop.
for k in range(2,25): # Train LDA on different values of k
print('Round: '+str(k))
LDA = gensim.models.ldamulticore.LdaMulticore
ldamodel = LDA(doc_term_matrix, num_topics=k, id2word = dictionary, passes=20, iterations=100,
chunksize = 10000, eval_every = 10, random_state=20)
ldamodel.save(f"ldamodel_for_{k}topics_Run_10")
pprint(ldamodel.print_topics())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment