From 861068af3852f74cb68fe8013e8cb4791069eb95 Mon Sep 17 00:00:00 2001 From: seanpwilliams Date: Tue, 7 Feb 2017 18:49:57 -0800 Subject: [PATCH 1/2] remove assignment per recommendation --- doc/tutorial/text_analytics/working_with_text_data.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/tutorial/text_analytics/working_with_text_data.rst b/doc/tutorial/text_analytics/working_with_text_data.rst index 041943ee83675..d0499aedb31cc 100644 --- a/doc/tutorial/text_analytics/working_with_text_data.rst +++ b/doc/tutorial/text_analytics/working_with_text_data.rst @@ -324,7 +324,7 @@ The names ``vect``, ``tfidf`` and ``clf`` (classifier) are arbitrary. We shall see their use in the section on grid search, below. We can now train the model with a single command:: - >>> text_clf = text_clf.fit(twenty_train.data, twenty_train.target) + >>> text_clf.fit(twenty_train.data, twenty_train.target) Evaluation of the performance on the test set @@ -353,7 +353,7 @@ classifier object into our pipeline:: ... ('clf', SGDClassifier(loss='hinge', penalty='l2', ... alpha=1e-3, n_iter=5, random_state=42)), ... ]) - >>> _ = text_clf.fit(twenty_train.data, twenty_train.target) + >>> text_clf.fit(twenty_train.data, twenty_train.target) >>> predicted = text_clf.predict(docs_test) >>> np.mean(predicted == twenty_test.target) # doctest: +ELLIPSIS 0.912... From 46718742c193435c65e933ba310f661e8eb821d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Est=C3=A8ve?= Date: Wed, 8 Feb 2017 08:57:31 +0100 Subject: [PATCH 2/2] Fix doctests --- doc/tutorial/text_analytics/working_with_text_data.rst | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/doc/tutorial/text_analytics/working_with_text_data.rst b/doc/tutorial/text_analytics/working_with_text_data.rst index d0499aedb31cc..b23d4ad98e8c3 100644 --- a/doc/tutorial/text_analytics/working_with_text_data.rst +++ b/doc/tutorial/text_analytics/working_with_text_data.rst @@ -324,7 +324,8 @@ The names ``vect``, ``tfidf`` and ``clf`` (classifier) are arbitrary. We shall see their use in the section on grid search, below. We can now train the model with a single command:: - >>> text_clf.fit(twenty_train.data, twenty_train.target) + >>> text_clf.fit(twenty_train.data, twenty_train.target) # doctest: +ELLIPSIS + Pipeline(...) Evaluation of the performance on the test set @@ -353,7 +354,8 @@ classifier object into our pipeline:: ... ('clf', SGDClassifier(loss='hinge', penalty='l2', ... alpha=1e-3, n_iter=5, random_state=42)), ... ]) - >>> text_clf.fit(twenty_train.data, twenty_train.target) + >>> text_clf.fit(twenty_train.data, twenty_train.target) # doctest: +ELLIPSIS + Pipeline(...) >>> predicted = text_clf.predict(docs_test) >>> np.mean(predicted == twenty_test.target) # doctest: +ELLIPSIS 0.912...