Skip to content

Instantly share code, notes, and snippets.

@aneesha
Created September 1, 2016 00:27
Show Gist options
  • Save aneesha/accd591cf24cc7237ed623a102729ea8 to your computer and use it in GitHub Desktop.
Save aneesha/accd591cf24cc7237ed623a102729ea8 to your computer and use it in GitHub Desktop.
from sklearn.decomposition import NMF, LatentDirichletAllocation
no_topics = 20
# Run NMF
nmf = NMF(n_components=no_topics, random_state=1, alpha=.1, l1_ratio=.5, init='nndsvd').fit(tfidf)
# Run LDA
lda = LatentDirichletAllocation(n_topics=no_topics, max_iter=5, learning_method='online', learning_offset=50.,random_state=0).fit(tf)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment