Contents

6.5.4. scikits.learn.ball_tree.knn_brute

scikits.learn.ball_tree.knn_brute(x, pt, k=1)

Brute-Force k-nearest neighbor search.

Parameters :

x : array of shape [N,D]

representing N points in D dimensions

pt : array-like, last dimension D

An array of points to query

k : a positive integer, giving the number of nearest

neighbors to query

Returns :

nbrs : array of integers - shape: pt.shape[:-1] + (k,)

each entry gives the list of indices of neighbors of the corresponding point