Skip to main content
QUICK REVIEW

[Paper Review] k*-Nearest Neighbors: From Global to Local

Oren Anava, Kfir Y. Levy|arXiv (Cornell University)|Jan 25, 2017
Statistical Methods and InferenceMathematics41 citations
TL;DR

This paper introduces $k^*$-Nearest Neighbors, a novel locally adaptive $k$-NN method that jointly optimizes the number of neighbors $k$ and their weights for each prediction point by explicitly modeling the bias-variance tradeoff. It achieves superior performance over standard $k$-NN and Nadaraya-Watson methods on 7 out of 8 real-world datasets, with statistically significant improvements on 3, by enabling per-point adaptive $k$ and optimal weights via a greedy algorithm.

ABSTRACT

The weighted k-nearest neighbors algorithm is one of the most fundamental non-parametric methods in pattern recognition and machine learning. The question of setting the optimal number of neighbors as well as the optimal weights has received much attention throughout the years, nevertheless this problem seems to have remained unsettled. In this paper we offer a simple approach to locally weighted regression/classification, where we make the bias-variance tradeoff explicit. Our formulation enables us to phrase a notion of optimal weights, and to efficiently find these weights as well as the optimal number of neighbors efficiently and adaptively, for each data point whose value we wish to estimate. The applicability of our approach is demonstrated on several datasets, showing superior performance over standard locally weighted methods.

Motivation & Objective

  • To address the long-standing challenge of selecting optimal $k$ and weights in $k$-NN for non-parametric regression and classification.
  • To develop a method that adapts $k$ and weights locally, per prediction point, rather than globally for the entire dataset.
  • To provide a theoretically grounded, principled approach to locally optimal estimation by explicitly modeling the bias-variance tradeoff.
  • To enable per-prediction confidence guarantees and improve generalization in finite-sample regimes.

Proposed method

  • Formulates a local prediction problem that explicitly balances bias and variance to define optimal weights and $k$ for each data point.
  • Derives a closed-form solution for the optimal weight vector under the bias-variance tradeoff, enabling efficient computation.
  • Proposes a greedy algorithm to efficiently and exactly compute the optimal $k$ and weights for each test point, avoiding exhaustive search.
  • Uses $5$-fold cross-validation on a validation set to tune the $L/C$ hyperparameter, which controls the tradeoff between bias and variance in the optimization.
  • Employs a Gaussian kernel for comparison, though the method is kernel-agnostic and can be applied with any distance metric.
  • Applies the method to both binary classification and regression tasks without model reconfiguration, leveraging the same framework across diverse datasets.

Experimental results

Research questions

  • RQ1Can we define a principled notion of optimal $k$ and weights that varies per data point, rather than being fixed globally?
  • RQ2How can we efficiently compute the optimal $k$ and weights for each prediction point while maintaining theoretical guarantees?
  • RQ3Does adaptive selection of $k$ and weights lead to improved performance in finite-sample, non-asymptotic settings?
  • RQ4Can we provide per-prediction confidence bounds based on the local bias-variance tradeoff?

Key findings

  • The proposed $k^*$-NN method outperforms standard $k$-NN and Nadaraya-Watson methods on 7 out of 8 real-world datasets from the UCI repository.
  • On three datasets—QSAR, Ionosphere, and Yacht—the improvement of $k^*$-NN over the second-best method is statistically significant at the 0.05 level.
  • The method achieves lower absolute error rates than standard $k$-NN and Nadaraya-Watson across all datasets, with the best results marked by an asterisk in Table 1.
  • The range of $k$ values selected by $k^*$-NN varies per data point (e.g., 1–4 for QSAR, 1–9 for Diabetes), demonstrating effective local adaptivity.
  • The method's performance is robust across different data types, including binary classification (e.g., Sonar, Fertility) and regression (e.g., Slump, Yacht).
  • The use of a greedy algorithm enables exact computation of optimal $k$ and weights without exhaustive search, making the method scalable and practical.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.