Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

DOC small fixes to NearestCentroid classifier

Point out connection to Rocchio classifier from NLP/IR.
  • Loading branch information...
commit 91a7b655577f4518c795c5770bdf1db31aa803e1 1 parent 8b76679
@larsmans authored
2  doc/modules/neighbors.rst
@@ -363,7 +363,7 @@ does, however, suffer on non-convex classes, as well as when classes have
drastically different variances, as equal variance in all dimensions is
assumed. See Linear Discriminant Analysis (:class:`sklearn.lda.LDA`) and
Quadratic Discriminant Analysis (:class:`sklearn.qda.QDA`) for more complex
-methods that do not make this assumpation. Usage of the default
+methods that do not make this assumption. Usage of the default
:class:`NearestCentroid` is simple:
>>> from sklearn.neighbors.nearest_centroid import NearestCentroid
2  examples/
@@ -212,7 +212,7 @@ def benchmark(clf):
# Train NearestCentroid without threshold
print 80 * '='
-print "NearestCentroid, no shrinkage"
+print "NearestCentroid (aka Rocchio classifier)"
# Train sparse Naive Bayes classifiers
11 sklearn/neighbors/
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
Nearest Centroid Classification
@@ -16,8 +17,7 @@
class NearestCentroid(BaseEstimator, ClassifierMixin):
- """
- Nearest Centroid Classification
+ """Nearest centroid classifier.
Each class is represented by its centroid, with test samples classified to
the class with the nearest centroid.
@@ -53,7 +53,12 @@ class NearestCentroid(BaseEstimator, ClassifierMixin):
See also
- sklearn.neighbors.KNeighborsClassifier: Nearest Neighbors Classifier
+ sklearn.neighbors.KNeighborsClassifier: nearest neighbors classifier
+ Notes
+ -----
+ When used for text classification with tf–idf vectors, this classifier is
+ also known as the Rocchio classifier.
Please sign in to comment.
Something went wrong with that request. Please try again.