Distributed Nearest Neighbor Classification

Jiexin Duan, Xingye Qiao, Guang ChengarXiv 2018 · DOI

Abstract

Nearest neighbor is a popular nonparametric method for classification and regression with many appealing properties. In the big data era, the sheer volume and spatial/temporal disparity of big data may prohibit centrally processing and storing the data. This has imposed a considerable hurdle for nearest neighbor predictions since the entire training data must be memorized. One effective way to overcome this issue is the distributed learning framework. Through majority voting, the distributed nearest neighbor classifier achieves the same rate of convergence as its oracle version in terms of both the regret and instability, up to a multiplicative constant that depends solely on the data dimension. The multiplicative difference can be eliminated by replacing majority voting with the weighted voting scheme. In addition, we provide sharp theoretical upper bounds of the number of subsamples in order for the distributed nearest neighbor classifier to reach the optimal convergence rate. It is interesting to note that the weighted voting scheme allows a larger number of subsamples than the majority voting one. Our findings are supported by numerical studies using both simulated and real data sets.

Introduction

The $k$-Nearest Neighbor (kNN) algorithm is a cornerstone of non-parametric machine learning, valued for its simplicity and effectiveness. However, kNN faces significant scaling challenges in the "Big Data" era. Because it requires storing the entire training set ($O(Nd)$ space) and performing exhaustive comparisons for queries, a single machine often lacks the memory or processing power to handle modern datasets. While distributed frameworks like MapReduce offer a path to parallelization, the statistical implications of splitting data across multiple nodes were previously poorly understood. This research investigates whether distributed kNN can match the performance of a centralized "oracle" model.

Distributed Frameworks

The study evaluates two primary distributed architectures for kNN classification:

  1. M-DNN (Majority Voting): The dataset is partitioned into $s$ subsamples. Each node constructs a local kNN classifier and produces a hard label (0 or 1). The final classification is determined by a majority vote across all nodes.
  2. W-DNN (Weighted Voting): Instead of hard labels, each node provides a local regression estimate—a probability value between 0 and 1. These estimates are averaged globally, and the final classification is made based on whether this average exceeds a specific threshold.

Performance is measured using Asymptotic Regret (excess risk relative to the Bayes classifier) and Classification Instability (CIS), comparing these distributed models against a centralized oracle with access to the full dataset.

Theoretical Insights

A key finding of the research is the identification of the "Majority Voting Constant" ($Q$). The authors demonstrate that while M-DNN is slightly less accurate than the oracle, the gap is defined by this multiplicative constant $Q$, which is purely a function of the data dimension $d$.

The behavior of the majority voting constant $Q$ across varying dimensions $d$.

As illustrated in the figure above, $Q$ decreases as the dimension $d$ increases, eventually approaching 1. This represents a rare "blessing of dimensionality": in higher-dimensional spaces, the statistical penalty for using simple majority voting becomes negligible. Furthermore, the researchers proved that the Weighted Voting (W-DNN) scheme eliminates this $Q$ factor entirely, achieving the same asymptotic regret as the optimal centralized weighted kNN.

Another critical theoretical contribution is the establishment of "sharp upper bounds" for parallelization. There is a limit to how many machines ($s$) the data can be split across before performance degrades:

  • M-DNN limit: $s < N^{2/(d+4)}$
  • W-DNN limit: $s < N^{4/(d+4)}$

Notably, Weighted Voting allows for significantly more massive parallelization than Majority Voting, making it the superior choice for extremely large-scale applications.

Empirical Results

The theoretical findings were validated using synthetic simulations and seven real-world datasets, including the SUSY dataset containing 5 million observations.

  • Efficiency: On the SUSY dataset, the distributed approach achieved speedups of up to 72x compared to centralized processing while maintaining nearly identical accuracy.
  • Accuracy: Across all real-world tests (including HTRU2, Gisette, and Musk), the error rate of W-DNN remained within a fraction of a percent of the centralized Optimal Weighted Nearest Neighbor (OWNN) model.
  • Stability: W-DNN demonstrated superior stability compared to Bagged Nearest Neighbors (BNN), whereas M-DNN was found to be less stable.

Conclusion

Distributed nearest neighbor classification is a viable and efficient strategy for big data. While majority voting is effective and benefits from higher dimensionality, weighted voting stands out as the gold standard, matching oracle performance and supporting higher levels of parallelization. Future work may extend these findings to multi-category classification and explore the robustness of distributed kNN against adversarial perturbations.

Summary updated

BibTeX
@misc{duan2018distributed,
  author = {Jiexin Duan and Xingye Qiao and Guang Cheng},
  title = {{Distributed Nearest Neighbor Classification}},
  year = {2018},
  eprint = {1812.05005},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1812.05005},
}
Figure