On the Consistency of Exact and Approximate Nearest Neighbor with Noisy Data

Wei Gao, Xin-Yi Niu, Zhi-Hua ZhouarXiv 2016

Abstract

Nearest neighbor has always been one of the most appealing non-parametric approaches in machine learning, pattern recognition, computer vision, etc. Previous empirical studies partly shows that nearest neighbor is resistant to noise, yet there is a lack of deep analysis. This work presents the finite-sample and distribution-dependent bounds on the consistency of nearest neighbor in the random noise setting. The theoretical results show that, for asymmetric noises, k-nearest neighbor is robust enough to classify most data correctly, except for a handful of examples, whose labels are totally misled by random noises. For symmetric noises, however, k-nearest neighbor achieves the same consistent rate as that of noise-free setting, which verifies the resistance of k-nearest neighbor to random noisy labels. Motivated by the theoretical analysis, we propose the Robust k-Nearest Neighbor (RkNN) approach to deal with noisy labels. The basic idea is to make unilateral corrections to examples, whose labels are totally misled by random noises, and classify the others directly by utilizing the robustness of k-nearest neighbor. We verify the effectiveness of the proposed algorithm both theoretically and empirically.

Introduction

While $k$-Nearest Neighbor ($k$-NN) is a staple of machine learning, its behavior under label noise has long lacked a rigorous theoretical foundation. In real-world applications, labels are frequently "noisy"—flipped by human error, sensor glitches, or malicious interference. While parametric models like Support Vector Machines (SVMs) and Boosting are known to be sensitive to this Random Classification Noise (RCN), the research community has generally observed that the non-parametric $k$-NN algorithm seems more resilient. This paper provides the first deep analysis regarding why $k$-NN resists noise and exactly where that resistance breaks down, culminating in the development of the Robust $k$-Nearest Neighbor (R$k$NN) algorithm.

Theoretical Analysis of Noise Consistency

The paper approaches the problem by deriving finite-sample and distribution-dependent bounds on the consistency of $k$-NN. The analysis distinguishes between two primary noise models:

  1. Symmetric Noise: Where the probability of a label flipping (e.g., $+1$ to $-1$) is equal to the reverse. The authors prove that for symmetric noise, $k$-NN achieves the same consistency rate as it does in a noise-free setting as $k$ and $n$ approach infinity. This formally justifies $k$-NN's reputation for noise resistance.
  2. Asymmetric Noise: Where flipping probabilities differ between classes. Here, the authors identify a specific "misled" set of data points, denoted as $A_0$. In these regions, the noise is strong enough to flip the majority label of the neighborhood, causing standard $k$-NN to fail.

A key theoretical finding is that while $k$-NN (for large $k$) is robust, 1-Nearest Neighbor remains inconsistent even under symmetric noise. This highlights that the "voting" mechanism of multiple neighbors is essential for noise resistance.

The Robust $k$-Nearest Neighbor (R$k$NN) Algorithm

Motivated by the finding that $k$-NN failure is localized to the $A_0$ set, the authors proposed R$k$NN. Unlike most noise-robust algorithms that attempt to modify a global loss function, R$k$NN applies local corrections. The algorithm operates in three stages:

  • Noise Estimation: It utilizes a separate $k'$-nearest neighbor pass to estimate noise proportions ($ au_+$ and $ au_-$) by examining the extreme values of the corrupted conditional probability.
  • Identification: It identifies instances falling into the "misled" $A_0$ region where noise has likely overpowered the true signal.
  • Unilateral Correction: The algorithm makes targeted corrections only to these misled examples, allowing the inherent robustness of $k$-NN to handle the remainder of the dataset.

Experimental Results

The authors validated R$k$NN using a 2D synthetic dataset with a sine-wave decision boundary and 20 diverse benchmark datasets from the UCI and LibSVM repositories (including heart, ionosphere, and usps).

Key results include:

  • Superior Accuracy: R$k$NN outperformed or matched traditional $k$-NN in 55 out of 60 tested scenarios across various noise levels.
  • State-of-the-Art Performance: R$k$NN consistently outperformed other noise-handling algorithms such as IR-KSVM, AROW, and NHERD, showing particular stability as noise proportions increased.
  • Theory Validation: Synthetic experiments mirrored theoretical predictions; while standard $k$-NN's error rate converged to a baseline plus the measure of the $A_0$ set, R$k$NN successfully converged toward the Bayes error.

Conclusion

This work provides a rigorous mathematical foundation for the observed robustness of $k$-NN and introduces a practical improvement in the form of R$k$NN. By focusing on "unilateral corrections" in misled regions, the algorithm achieves performance levels comparable to noise-free settings. Future work may involve extending this framework to high-dimensional datasets by integrating approximate nearest neighbor techniques or dimensionality reduction.

Summary updated

BibTeX
@misc{gao2016consistency,
  author = {Wei Gao and Xin-Yi Niu and Zhi-Hua Zhou},
  title = {{On the Consistency of Exact and Approximate Nearest Neighbor with Noisy Data}},
  year = {2016},
  eprint = {1607.07526},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1607.07526},
}
Figure