December 2018
Intermediate to advanced
318 pages
8h 28m
English
The multinomial Naive Bayes classifier is suitable for classification with discrete features (for example, word counts for text classification). The multinomial distribution normally requires integer feature counts. However, in practice, fractional counts such as TF-IDF may also work:
pipeline_parts = [ ('vectorizer', CountVectorizer()), ('classifier', MultinomialNB()) ] simple_pipeline = Pipeline(pipeline_parts)
A simple pipeline with Naive Bayes and the CountVectorizer is created as shown previously.
Import GridSearchCV as shown here:
from sklearn.model_selection import GridSearchCV
GridSearch performs an exhaustive search over specified parameter values for an estimator, and is thus helpful ...
Read now
Unlock full access