The theoretical results provide a principled non-cross-validated alternative to the classical n rule, and cross-validation remains the strongest k-selection strategy when computationally feasible.
Abstract
The k-nearest neighbor (KNN) algorithm remains one of the most fundamental and widely-used methods in machine learning. A common rule of thumb sets the number of neighbors as k=n, where n is the size of the training set. Despite its widespread adoption, the theoretical justification for this choice has remained obscure. We provide a comprehensive rate-based analysis. First, we derive the minimax-optimal exponent β*=4/(d+4) for k=nβ under standard Hölder-smoothness assumptions, recovering as a special case Theorem 1: under these second-order Hölder-smoothness assumptions, k=n attains the asymptotic minimax-optimal exponent if and only if the feature space has dimensionality d=4; this concerns the asymptotic rate exponent, not the finite-sample optimal value of k. Second, Theorem 2 quantifies the sub-optimality of any fixed β as Rn(nβ)=Θ(n−r(β,d)) with r(β,d)=min{β,4(1−β)/d}, yielding an asymmetric penalty for the classical rule when d≠4 that we make precise in Corollary 1. The predicted rate is empirically verified across d∈{2,…,20} on controlled synthetic data. On 48 datasets from the OpenML-CC18 benchmark suite, the dimension-aware rule k=⌊n4/(d+4)⌋ outperforms the classical n rule in 32 of 48 head-to-head comparisons (paired Wilcoxon p=4.6×10−4, mean accuracy gain +2.5 percentage points), demonstrating that the theoretical improvement translates to a practical one. We further test the Hassanat distance metric against Euclidean across all KNN variants on the same 48 datasets, finding that Hassanat outperforms Euclidean in five of six configurations (paired Wilcoxon p<0.05), with the largest gains on unstandardized data. Cross-validation remains the strongest k-selection strategy when computationally feasible, and the theoretical results provide a principled non-cross-validated alternative.
This work proposes a neighboring early-stopping rule for adaptive regularization in KRR with random features (KRR-RF), using a grid that is uniform in inverse regularization and compares only adjacent estimators, reducing the number of discrepancy comparisons relative to standard all-pairs Lepskii-type procedures.
Experimental results demonstrate that the proposed adaptive and efficient KNN approach via granular-ball computing outperforms existing KNN variants across multiple datasets in terms of both accuracy and efficiency.
Xiaoyu Lian, Shuyin Xia, Hongxuan He et al.· 0 citations
This work proves the $L_2$-consistency of the derivative estimator under mild regularity conditions on the densities and their domain and reformulates this optimization via a derivative condition, whose zero locates the optimal mixture parameter, and estimates the derivative directly using a-nearest-neighbor method.
Numerical experiments show that GW quantization opens up many modeling possibilities beyond normal clustering methods and that the introduced algorithm leads to useful numerical solutions with approximation quality often in line with theoretically optimal rates.
The null distribution of distance covariance is usually approximated by permutation, which is prohibitive when very small p-values are needed, or by matching a few moments to a parametric family, which is inaccurate in the tails. A third option is to approximate the limiting distribution, a weighted sum of chi-square variables, directly through the spectra of the doubly centred distance matrices. This is used for kernel-based tests but has lacked a rigorous justification. We prove that the empirical spectra give a uniformly consistent approximation of the limiting null distribution, and hence an asymptotically valid test, for a general class of distances of negative type on separable metric spaces. The result covers the Hilbert-Schmidt independence criterion as a special case. We also give an adaptive algorithm that brackets the p-value from a partial eigendecomposition, reducing the cost from $O(n^3)$ to $O(k n^2)$, and a shrinkage correction matching the first two moments. In simulations, the proposed tests are the only non-Monte-Carlo procedures whose empirical type I error converges to the nominal level.
A membership-restricted Shepard rho resolves single-point and minority-population questions that many-pair statistics cannot -- questions on which even DREAMS, a recent local-plus-global hybrid, fails silently.