November 2018
Beginner to intermediate
182 pages
4h 48m
English
Let's now remove the stop words for English again, by simply passing english to the tokenizer as follows:
mnb_clf = Pipeline([('vect', CountVectorizer(stop_words='english')), ('tfidf', TfidfTransformer()), ('clf',MNB())])mnb_clf.fit(X=X_train, y=y_train)mnb_acc, mnb_predictions = imdb_acc(mnb_clf)mnb_acc # 0.82992
This helps improve performance, but only marginally. We might be better off simply keeping in the stop words for other classifiers that we try.
As a last manual experiment, let's try adding bigrams and unigrams, as we did lfor ogistic regression, as follows:
mnb_clf = Pipeline([('vect', CountVectorizer(stop_words='english', ngram_range=(1,3))), ('tfidf', TfidfTransformer()), ('clf',MNB())])mnb_clf.fit(X=X_train, ...Read now
Unlock full access