knn_meanShift: K-d tree based k nearest neighbor search
Description
knn_meanShift performs a search for the k nearest neighbors of a single
point, where nearest is determined by the Mahalanobis distance. This search
is performed through a k-d tree.
n vectors stored in an n by p matrix. k nearest neighbors are
found for each vector.
trainData
A matrix or vector of potential nearest neighbors.
k
A scalar indicating the number neighbors to find.
weight
A scalar or vector of length equal to the number of columns of
trainData. This value is used as the diagonal elements for the
inverse covariance matrix of the Mahalanobis distance.
leafSize
A scalar used to specify the number of points to store in the
leaf nodes.
maxDist
A vector specifying the maximum value of the Mahalanobis that
will be considered.
Value
A list is returned containing two items: neighbors, an n by k
matrix of k indexes for each of the n vectors in points, corresponding to
the nearest neighbors in trainData. value, a matrix of scalars
containing the k distances between the neighbors found in trainData
and points.