Skip to content

Instantly share code, notes, and snippets.

@Damian89
Created October 18, 2017 20:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Damian89/781915e2e50356d76146193601c2b9f8 to your computer and use it in GitHub Desktop.
Save Damian89/781915e2e50356d76146193601c2b9f8 to your computer and use it in GitHub Desktop.
print()
print("TF-IDF + NMF")
tfidf_vect = feature_extraction.text.TfidfVectorizer(stop_words=stoplist)
tfidf_vect.fit(docs)
features = tfidf_vect.get_feature_names()
tfidf = tfidf_vect.transform(docs)
tfidf_lsi = decomposition.NMF(n_components=2)
tfidf_lsi.fit(tfidf)
print_topic_cloud(tfidf_lsi.components_,features,5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment