Created
September 1, 2016 00:33
-
-
Save aneesha/440f3d104415c6ae21851a062f3880d8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def display_topics(model, feature_names, no_top_words): | |
for topic_idx, topic in enumerate(model.components_): | |
print "Topic %d:" % (topic_idx) | |
print " ".join([feature_names[i] | |
for i in topic.argsort()[:-no_top_words - 1:-1]]) | |
no_top_words = 10 | |
display_topics(nmf, tfidf_feature_names, no_top_words) | |
display_topics(lda, tf_feature_names, no_top_words) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment