SecSIGSecurity Special Interest Group of US MensaCuriosity. Perspective. Security.

Research Library · Idea

Nearest neighbours

The nearest-neighbour rule classifies a new point with the label of the closest labelled point under some distance, often Euclidean; the k-nearest-neighbour version takes a vote among the k closest. It fits no parametric model and keeps the labelled data.1 A larger k can average over label noise at the cost of bias, while k = 1 follows every label.

Cover and Hart's 1967 paper asks how good the rule can be with unlimited data and no knowledge of the distribution. Their abstract states that in the M-category case the limiting error R of the one-neighbour rule satisfies B ≤ R ≤ B(2 - MB/(M-1)), where B is the Bayes error, the lowest error any rule can reach; that the bounds are the tightest possible for all suitably smooth distributions; and hence that the error is bounded above by twice the Bayes error.2 For two classes the bound is 2B(1-B): a Bayes error of 10% gives a limit of at most 18%. The result concerns the limit of unlimited independent samples under smoothness conditions, and gives no guarantee for a particular training set.2

The rule's weakness is the curse of dimensionality. ISLR's regression example shows a neighbour method working in one dimension with 100 training points, but with 20 dimensions a point has no nearby neighbours and the test error rose more than ten-fold while linear regression barely changed.1 In a unit cube, a sub-cube holding 10% of the volume has edge 0.1^(1/p): 0.79 for p = 10 and 0.977 for p = 100. Distances also depend on feature scaling, and irrelevant features add noise.1

Neighbour methods are simple baselines, but for large tables with mixed and irrelevant features tree ensembles are usually preferred in benchmarks. In Cortes and Vapnik's digit benchmark a 3-nearest-neighbour classifier with 60,000 prototypes was one of the compared methods.3

Source · Nearest Neighbor Pattern Classification (opens in a new tab) · Cover and Hart, IEEE Transactions on Information Theory IT-13(1), pp. 21-27, 1967

References

  1. An Introduction to Statistical Learning with Applications in R (first edition, seventh printing) (opens in a new tab) · James, Witten, Hastie and Tibshirani, Springer · January 1, 2013 ↩ ↩ ↩
  2. Nearest Neighbor Pattern Classification (opens in a new tab) · IEEE Transactions on Information Theory IT-13(1) · January 1, 1967 ↩ ↩
  3. Support-Vector Networks (opens in a new tab) · Machine Learning 20, 1995 · January 1, 1995 ↩

Research articles

See what connects to it on the map of ideas →

See also