Evolutionary Adaptive Neighborhood Learning: A Genetic Algorithm for Instance-Dependent k Optimization in Nearest Neighbor Classification
Isaac Touza, Kaladzavi Guidedi, Kolyang
Abstract
The number of neighbours is the central hyper-parameter of the -nearest
neighbour (-NN) classifier, and it is almost always chosen globally, by cross-validation or, increasingly, by evolutionary search. Yet the bias--variance trade-off that governs is local: dense, noise-free regions favour small neighbourhoods, whereas sparse or label-noisy regions favour large ones. Because the global- search space is one-dimensional, replacing exhaustive search by a genetic algorithm (GA) cannot improve on it. We therefore change the object being optimised. We propose EANK (Evolutionary Adaptive Neighborhood ), which evolves a low-dimensional policy mapping a description of the local neighbourhood of a point (density, label entropy at two scales, vote margin, concentration, relative density) to an instance-dependent number of neighbours . A real-coded elitist GA maximises the leave-one-out accuracy of the induced adaptive rule, penalised by a neighbourhood-smoothness term. A pre-computed vote table reduces each fitness evaluation to look-ups. We prove that (i)~a seeded EANK never does worse than the best global on its training criterion, (ii)~the GA converges almost surely to the essential supremum of the fitness, (iii)~the learned neighbourhood size is Lipschitz in the meta-features, and (iv)~the policy class has a growth function polynomial in the sample size with exponent . This yields a uniform generalisation bound that does not depend on , which per-instance
encodings do not enjoy. On a controlled benchmark with spatially heterogeneous structure, EANK recovers small neighbourhoods in the fine-grained region and large ones in the noisy region, and it improves accuracy over the best global at every noise level. In a nested, -fold evaluation on twelve public datasets, EANK obtains the best average rank among six -NN variants. Its accuracy is statistically indistinguishable from the tuned global- baselines, and it is significantly better than the default . We document the gap between in-sample and out-of-sample gains, and we identify it as the main obstacle for adaptive-neighbourhood methods.