Skip to content

Commit abee93d

Browse files
jaquesgrobleramueller
authored andcommitted
andys suggestions and test
1 parent 329aa4e commit abee93d

File tree

4 files changed

+15
-4
lines changed

4 files changed

+15
-4
lines changed

doc/modules/neighbors.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ of each option, see `Nearest Neighbor Algorithms`_.
5353

5454
.. warning::
5555

56-
Regarding the Nearest Neighbors algorithms, if it is found that two
56+
Regarding the Nearest Neighbors algorithms, if two
5757
neighbors, neighbor `k+1` and `k`, have identical distances but
58-
but different labels, the results will depend on the odering of the
58+
but different labels, the results will depend on the ordering of the
5959
training data.
6060

6161
.. _classification:

sklearn/neighbors/classification.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
NeighborsBase, KNeighborsMixin,\
1919
RadiusNeighborsMixin, SupervisedIntegerMixin
2020
from ..base import ClassifierMixin
21-
from ..utils import atleast2d_or_csr
21+
from ..utils import atleast2d_or_csr, deprecated
2222

2323

2424
class KNeighborsClassifier(NeighborsBase, KNeighborsMixin,

sklearn/neighbors/regression.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
NeighborsBase, KNeighborsMixin, \
1717
RadiusNeighborsMixin, SupervisedFloatMixin
1818
from ..base import RegressorMixin
19-
from ..utils import atleast2d_or_csr
19+
from ..utils import atleast2d_or_csr, deprecated
20+
2021

2122

2223
class KNeighborsRegressor(NeighborsBase, KNeighborsMixin,

sklearn/neighbors/tests/test_neighbors.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -561,6 +561,16 @@ def test_neighbors_badargs():
561561
nbrs.radius_neighbors_graph,
562562
X, mode='blah')
563563

564+
def test_neighbors_deprecation_arg():
565+
"""Test that passing the deprecated parameter will cause a
566+
warning to be raised, as well as not crash the estimator."""
567+
for cls in (neighbors.KNeighborsClassifier,
568+
neighbors.KNeighborsRegressor):
569+
with warnings.catch_warnings(record=True) as w:
570+
warnings.simplefilter("always")
571+
A = cls(warn_on_equidistant=True)
572+
assert_equal(len(w), 1)
573+
564574

565575
if __name__ == '__main__':
566576
import nose

0 commit comments

Comments
 (0)