NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Boosting k-NN for Categorization of Natural Scenes

Richard Nock, Paolo Piro, Frank Nielsen, Wafa Bel Haj Ali, Michel BarlaudIJCV 2012

Abstract

The k-nearest neighbors (k-NN) classification rule is widely used in computer vision but suffers from high variance in high-dimensional, sparse datasets. We propose a novel boosting approach, Universal Nearest Neighbors (UNN), which transforms k-NN into a leveraged strong classifier. By learning optimal weights (leveraging coefficients) for the k-nearest prototypes to minimize a surrogate risk, UNN identifies the most relevant prototypes for classification. Experiments on natural scene categorization using Gist and Bag-of-Features descriptors demonstrate that UNN outperforms classic k-NN and competes with SVMs and AdaBoost, while significantly reducing inference time through data filtering.

Introduction

The $k$-nearest neighbors ($k$-NN) algorithm is a fundamental tool in pattern recognition due to its simplicity. However, it faces two significant challenges: high variance in sparse, high-dimensional spaces and the limitations of uniform voting. Classic $k$-NN treats all $k$ neighbors equally, ignoring the fact that some prototypes are more representative of a class than others.

This paper addresses these issues through the lens of boosting. Rather than deforming the distance metric, we redefine the voting rule as a strong classifier that linearly combines predictions from the $k$ closest prototypes. The resulting algorithm, Universal Nearest Neighbors (UNN), learns exactly how much each neighbor should contribute to the final decision.

Methodology

UNN introduces a leveraged $k$-NN rule: $$h_c(o) = \sum_{j \sim_k o} \alpha_{jc} y_{jc}$$ where $\alpha_{jc}$ is a "leveraging coefficient" learned for prototype $j$ regarding class $c$.

Key Technical Innovations

  • Boosting Framework: UNN iteratively selects prototypes and updates their coefficients to minimize a surrogate risk (e.g., exponential or logistic loss).
  • Reciprocal Neighbors: Optimization is streamlined by focusing on instances where the current prototype is among their $k$-nearest neighbors.
  • Universality: UNN can be adapted to any classification-calibrated surrogate loss function.
  • Data Filtering: Learning these weights naturally leads to sparsity; prototypes with near-zero coefficients can be discarded, resulting in a faster, more efficient model.

Experimental Setup

UNN was evaluated on two primary benchmarks:

  1. Ripley’s Synthetic Dataset: A two-class problem with overlapping Gaussians used to measure proximity to the theoretical Bayes optimal error rate.
  2. Natural Scene Database: 2688 images across 8 categories (e.g., forest, mountain, city). Scenes were represented using Gist descriptors to capture global spatial layouts.

Key Insights and Results

UNN effectively increases the "margin" between classes by filtering out confusing prototypes near the decision boundary. This creates a cleaner separation in the feature space, as seen in the learned decision boundaries.

Decision boundaries learned by UNN on training and test sets, illustrating margin maximization.

Performance and Efficiency

  • Accuracy Gains: UNN consistently outperformed classic $k$-NN on natural scene data, yielding a ~3% improvement in mean Average Precision (mAP). On the Ripley dataset, it approached the 8% Bayes optimal limit.
  • Robustness to $k$: UNN's performance remains stable across various values of $k$, unlike classic $k$-NN which can be highly sensitive to neighborhood size.
  • Efficiency via Filtering: By retaining only 25% of training prototypes ($\theta = 0.25$), UNN not only maintained but often improved accuracy, achieving up to a 16x speedup in classification time.
Misclassification error rate vs. $k$ for $k$-NN and UNN with varying filtering thresholds $\theta$.

Conclusion

UNN successfully "boosts" the $k$-NN rule into a leveraged strong classifier. By learning optimal weights and enabling massive data reduction, it improves both accuracy and inference speed. Future work will explore integrating UNN with local features and end-to-end metric learning.

Summary updated

BibTeX
@article{nock2012boosting,
  author = {Richard Nock and Paolo Piro and Frank Nielsen and Wafa Bel Haj Ali and Michel Barlaud},
  title = {{Boosting k-NN for Categorization of Natural Scenes}},
  journal = {Int. J. Comput. Vis.},
  year = {2012},
  url = {https://openreview.net/forum?id=AfxsgO1X6-3},
}
Figure