It searches for KNN in a N \times d data matrix
data where N are the number of samples, and
d is the dimension of space.

Either knn search in itself query=NULL or to query
new data points wrt to training dataset.

Usage

1

Arguments

data

an N \times d matrix, where N are
the samples and d is the dimension of space. For
large d knn search can be very slow.

k

number of nearest neighbors (excluding point
itself). Default: k=1.

query

(optional) an \tilde{N} \times d
matrix to find KNN in the training data for. Must have
the same d as data; can have lower or larger
\tilde{N} though. Default: query=NULL
meaning that nearest neighbors should be looked for in
the training data itself.