Skip to content

Commit 7d6c629

Browse files
committed
changed binomialNB to multinomialNB
1 parent 488f7d6 commit 7d6c629

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

doc/datasets/twenty_newsgroups.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,12 +193,12 @@ It loses even more if we also strip this metadata from the training data:
193193
... remove=('headers', 'footers', 'quotes'),
194194
... categories=categories)
195195
>>> vectors = vectorizer.fit_transform(newsgroups_train.data)
196-
>>> clf = BernoulliNB(alpha=.01)
196+
>>> clf = MultinomialNB(alpha=.01)
197197
>>> clf.fit(vectors, newsgroups_train.target)
198198
>>> vectors_test = vectorizer.transform(newsgroups_test.data)
199199
>>> pred = clf.predict(vectors_test)
200200
>>> metrics.f1_score(newsgroups_test.target, pred, average='macro')
201-
0.65437545099490202
201+
0.76995175184521725
202202

203203
Some other classifiers cope better with this harder version of the task. Try
204204
running :ref:`example_model_selection_grid_search_text_feature_extraction.py` with and without

0 commit comments

Comments
 (0)