Created
September 11, 2017 18:13
-
-
Save mateisuica/3c6b5c6d53a64b1a295c15c86eb99fc4 to your computer and use it in GitHub Desktop.
Filter and Train Naive Bayes
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
from sklearn.feature_extraction.text import CountVectorizer | |
from sklearn.feature_extraction.text import TfidfTransformer | |
from sklearn.naive_bayes import MultinomialNB | |
from sklearn.pipeline import Pipeline | |
text_clf = Pipeline([('vect', CountVectorizer()), | |
('tfidf', TfidfTransformer()), | |
('clf', MultinomialNB()), | |
]) | |
text_clf = text_clf.fit(final_data, target) | |
print("\nDone training.\n") | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment