findNearest (cv.KNearest) - MATLAB File Help
cv.KNearest/findNearest

Finds the neighbors and predicts responses for input vectors

results = classifier.findNearest(samples, K)
[results,neiResp,dists,f] = classifier.findNearest(samples, K)
[...] = classifier.findNearest(..., 'OptionName', optionValue, ...)

Input

Output

For each input vector (a row of the matrix samples), the method finds the K nearest neighbors. In case of regression, the predicted result is a mean value of the particular vector's neighbor responses. In case of classification, the class is determined by voting.

For each input vector, the neighbors are sorted by their distances to the vector.

The function is parallelized with the TBB library.

See also
Method Details
Access public
Sealed false
Static false