Skip to content

Commit d5a91e8

Browse files
committed
FIX doctests failing on Numpy 1.6
1 parent d454eed commit d5a91e8

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

sklearn/neighbors/base.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -445,8 +445,12 @@ class from an array representing our data set and ask who's
445445
>>> neigh = NearestNeighbors(radius=1.6)
446446
>>> neigh.fit(samples) # doctest: +ELLIPSIS
447447
NearestNeighbors(algorithm='auto', leaf_size=30, ...)
448-
>>> print(neigh.radius_neighbors([1., 1., 1.])) # doctest: +ELLIPSIS
449-
(array([array([ 1.5, 0.5])]...), array([array([1, 2])]...)
448+
>>> dist, ind = neigh.radius_neighbors([1., 1., 1.])
449+
... # doctest: +ELLIPSIS
450+
>>> dist[0]
451+
array([ 1.5, 0.5])
452+
>>> ind[0]
453+
array([1, 2])
450454
451455
The first array returned contains the distances to all points which
452456
are closer than 1.6, while the second array returned contains their

sklearn/neighbors/unsupervised.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ class NearestNeighbors(NeighborsBase, KNeighborsMixin,
6464
... #doctest: +ELLIPSIS
6565
array([[2, 0]]...)
6666
67-
>>> neigh.radius_neighbors([0, 0, 1.3], 0.4, return_distance=False)
68-
array([array([2])], dtype=object)
67+
>>> neigh.radius_neighbors([0, 0, 1.3], 0.4, return_distance=False)[0]
68+
array([2])
6969
7070
See also
7171
--------

0 commit comments

Comments
 (0)