Created
May 24, 2017 10:12
-
-
Save Tathagatd96/762893f59fd0eb4a2ec7a4b3890b5cfe 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
#SVM Implementation | |
text_clf=Pipeline([('vect',CountVectorizer()),('tfidf',TfidfTransformer()),('clf',SGDClassifier(loss='hinge',alpha=1e-3,n_iter=5,random_state=42))]) | |
text_clf.fit(twenty_train.data,twenty_train.target) | |
predicted=text_clf.predict(doc_test) | |
print "SVM Accuracy:" | |
print(np.mean(predicted==twenty_test.target)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment