Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

KNN uses the K nearest neighbors. So if you are using a k of say, 7, and your sample has the nearest points as [1,0,0,0,0,0,0], it's going to return a label of 0, even if the distance to the first point is 0. KNN is designed to be noise tolerant, which includes occasionally mis-labeled points.

Some versions include a weight in importance based on the distance, but there are problems with that (for example, what weight do you use for distance 0, discrete spaces, and weighting different dimensions differently) and I don't think OpenCV's KNN does that.