Skip to content

Commit fc229a1

Browse files
jannabagramfort
authored andcommitted
[MRG + 1] docs: Change example of KDTree to prevent DeprecationWarning (scikit-learn#6962)
* docs: Change example of KDTree to prevent DeprecationWarning - fill in missing import statement of sklearn.neighbors.KDTree - wrap X in a list Changes to be committed: modified: sklearn/neighbors/binary_tree.pxi Resolves: scikit-learn#6906 * docs: remove import statement of KDTree in example of KDTree - remove import statement of sklearn.neighbors.KDTree Changes to be committed: modified: sklearn/neighbors/binary_tree.pxi Resolves: scikit-learn#6906
1 parent a2dac46 commit fc229a1

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

sklearn/neighbors/binary_tree.pxi

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -293,11 +293,10 @@ Examples
293293
Query for k-nearest neighbors
294294
295295
>>> import numpy as np
296-
297296
>>> np.random.seed(0)
298297
>>> X = np.random.random((10, 3)) # 10 points in 3 dimensions
299298
>>> tree = {BinaryTree}(X, leaf_size=2) # doctest: +SKIP
300-
>>> dist, ind = tree.query(X[0], k=3) # doctest: +SKIP
299+
>>> dist, ind = tree.query([X[0]], k=3) # doctest: +SKIP
301300
>>> print ind # indices of 3 closest neighbors
302301
[0 3 1]
303302
>>> print dist # distances to 3 closest neighbors

0 commit comments

Comments
 (0)