Created
May 24, 2017 10:11
-
-
Save Tathagatd96/b81c9411e7e89a874206f7ae99295ac0 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#Classifier Training | |
clf=MultinomialNB().fit(X_train_tfidf,twenty_train.target) | |
docs_new=['God is love','OpenGL on the GPU is fast'] | |
X_new_counts=count_vect.transform(docs_new) | |
X_new_tfidf=tfidf_transformer.transform(X_new_counts) | |
predicted=clf.predict(X_new_tfidf) | |
for doc,category in zip(docs_new,predicted): | |
print('%r=>%s'%(doc,twenty_train.target_names[category])) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment