Multinomial Naive Bayes model

Next, we train a Naive Bayes classifier using a document-term matrix produced by  CountVectorizer with default settings:

nb = MultinomialNB()
nb.fit(train_dtm,train.stars)
predicted_stars = nb.predict(test_dtm)

The prediction produces 64.7% accuracy on the test set, a 24.4% improvement over the benchmark:

accuracy_score(test.stars, predicted_stars)
0.6465164206691094
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.238.86.122