cs.LGNov 22, 2026

Randomized Weighted Distance Nearest Neighbor Classification

Authors: Shayan Shafaei, Naeem Shahabi Sani, Chao Lan

Organizations: School of Computer Science, University of Oklahoma

Abstract

The nearest neighbor classifier is known to be memory-inefficient, and a popular solution is to compress its training data. Recently, a compression algorithm based on weighted distance nearest neighbor (WNN) was proposed, which has elegant theoretical properties and effective classification performance. However, its compression process is computationally expensive, for it performs a greedy search of the densest homogeneous balls in data space. In this paper, we propose a randomized variant RWNN. It simply randomizes the ball search process, and results in substantially reduced compression time (often 0.1%--1% of WNN's) and similar classification accuracy. RWNN also inherits several theoretical properties of WNN including consistency and a generalization bound. Experimental results on multiple datasets demonstrate its efficacy.

Figures & tables

Explore similar work

Nov 25, 2026

Random Voronoi Networks

Nearest-neighbor methods are local, simple, and interpretable, but their non-parametric form makes them memory-intensive, expensive at inference, and difficult to integrate into differentiable neural architectures. We introduce Random Voronoi Networks (RVNs), a family of structured three-layer MLPs that express nearest-neighbor geometry through sampled Voronoi comparisons. The first layer computes Random Voronoi Features (RVF) from affine pairwise separators between selected training samples, the second layer aggregates these comparisons into Voronoi cells or top-k neighborhood scores, and the readout layer produces classification or regression predictions. We show that, when all samples and pairwise comparisons are included, step RVNs recover exact Euclidean k-NN, while ReLU RVNs provide a violation-score realization for 1-NN that can be relaxed into a differentiable soft weighting. Subsampling yields approximate RVNs with explicit control over the number of cells and features. We study several unsupervised sampling methods that trade off random coverage, directional diversity, coordinate sparsity, and empirical feature variance. Empirically, RVFs produce a highly effective data encoding strategy, providing performance boosts to downstream methods ranging from linear to modern tabular deep learning models. Finally, we showcase that RVF provides an interpretable feature map due to its k-NN based construction and ties to pairwise local directions. These results position our Random Voronoi formulation as a bridge between nearest-neighbor rules, random features, and modern tabular models.
Jun 9, 2026

kk-Nearest Neighbors in Gromov--Wasserstein Space

The Gromov--Wasserstein (GW) distance provides a framework for comparing metric measure spaces, regardless of their underlying structure or geometry. For network-based data, it enables direct comparisons of graphs with different numbers of nodes, without requiring an embedding or other abstraction. Furthermore, through a variant of GW known as fused Gromov--Wasserstein (fGW), it is also possible to incorporate node features in addition to graph structure. In this work, we implement kk-nearest neighbors (kk-NN) classification using the GW and fGW distances. We prove the universal consistency of the GW-kk-NN classifier on the space of equivalence classes of metric measure spaces with finite support and uniform probability measure. By viewing graphs as finitely supported metric measure spaces equipped with the pairwise distance metric and a uniform probability measure on the nodes, we obtain universal consistency of GW-kk-NN for the space of graphs. Likewise for fGW-kk-NN, we prove universal consistency on the space of weak isomorphism classes of structured objects consisting of metric measure spaces with finite support and uniform probability measure and feature maps into Euclidean space, thus establishing universal consistency on the space of node-attributed graphs. Our numerical experiments show that GW-kk-NN and fGW-kk-NN consistently perform well across multiple graph datasets, suggesting that metric classifiers such as kk-NN work well in the GW framework.
Aug 27, 2026

Curvature-Aware Radius Shrinkage for Adaptive Nearest Neighbor Classification

Nearest neighbor classification relies fundamentally on how locality is defined, yet conventional kk-NN imposes the same neighborhood cardinality throughout the feature space. This assumption can be inadequate for data whose local geometry varies substantially across the underlying manifold. We introduce Curvature-Aware Radius Shrinkage for Adaptive Nearest Neighbor Classification (CARSANN), a geometry-driven framework that adapts the spatial support of each neighborhood according to local geometric complexity. CARSANN first estimates intrinsic dimensionality using TwoNN and constructs an intrinsic representation through principal component analysis. Local mean curvature is then estimated using a shape-operator-based formulation and controls neighborhood scale: highly curved regions receive stronger radius shrinkage, whereas approximately flat regions retain broader spatial support. Unlike methods that modify only the number of neighbors or the local metric, CARSANN explicitly adapts the spatial extent of local evidence. Experiments on more than 70 real-world OpenML datasets show that CARSANN consistently improves upon standard kk-NN and is competitive with adaptive nearest-neighbor methods. In a controlled comparison using the same base neighborhood size, CARSANN achieves higher balanced accuracy on 40 of 45 datasets, increasing mean balanced accuracy from 0.6506 to 0.7528. The advantage also persists against kk-NN with fixed k=5k=5. Friedman and Nemenyi tests confirm that the improvements are statistically significant. These results indicate that local manifold curvature can serve as an effective geometric control variable for adapting neighborhood support, providing a complementary paradigm to cardinality-based nearest-neighbor adaptation.