Manuscript Offprint

arXiv:2611.08549

Evolutionary Adaptive Metric Learning: A Multi-Objective Framework for Learning Local Distance Functions in Nearest Neighbor Classification

Isaac Touza

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

Nearest neighbour classifiers inherit the geometry of the distance they use. Fixed distances (Euclidean, Manhattan, Mahalanobis) and global learned metrics (NCA, LMNN, ITML) apply the same geometry everywhere, whereas the relevant directions of real data may change from one region of the input space to another. We propose EAML (Evolutionary Adaptive Metric Learning), which attaches to every point xx a positive-definite matrix Mθ(x)=Dθ(x)+UU⊤+ϵIM_\theta(x) = D_\theta(x) + U U^\top + \epsilon I. Here Dθ(x)D_\theta(x) is a diagonal scaling interpolated between a few anchors by a softmax gating, and UU is a global low-rank correlation term. The matrices are not learned one by one: a real-coded elitist genetic algorithm evolves the low-dimensional parameters that generate them. It minimises a continuous scalarisation of four objectives: a leave-one-out stochastic-neighbour error, a robustness hinge on relative hit/miss margins, the smoothness of the metric field, and a shrinkage penalty. We prove that the learned matrices are uniformly positive definite and equivalent to the Euclidean metric, that an optimal metric exists, and that the metric field is Lipschitz. We also prove that kk-NN decisions are stable under perturbations smaller than an explicit margin, give a uniform generalisation bound whose complexity term depends on the number of evolved parameters rather than on the sample size, and show that the elitist GA converges in value to the global minimum almost surely. Empirically, on a controlled problem whose relevant feature switches between two regions, EAML recovers the region-dependent weights and is the most accurate method (93.2% vs. 91.4% for the best global metric). On thirteen public datasets under a nested 5×55 \times 5-fold protocol, the picture is more nuanced: EAML significantly improves on the Euclidean metric on Glass (+7.0 points) and Ionosphere (+4.6), but its average rank is not better than that of the global baselines. No method differs significantly from the others overall (Friedman p=0.14p = 0.14). Under nuisance features or test-time noise, a global evolved diagonal metric is preferable. We report these negative results together with diagnostics (unfinished search, gating misalignment, sharpened metrics with k=1k=1) that delimit when local metrics pay off.

Keywords: metric learning; local metrics; nearest neighbours; genetic algorithms; multi-objective optimisation; robustness; generalisation bounds.

1 Introduction

The kk-nearest neighbour (kk-NN) rule [3] classifies a point by looking at its closest training examples, so its behaviour is entirely determined by the notion of closeness. The Euclidean distance treats all features alike. The Mahalanobis distance [19] rescales and decorrelates them using the global covariance. Metric learning goes further and fits a Mahalanobis matrix to the labels: from side information [29], by maximising a stochastic leave-one-out score (NCA, 12),

*Corresponding author. E-mail: isaac_touza@outlook.fr.

with large-margin constraints (LMNN, 27) or with an information-theoretic regulariser (ITML, 4); see Bellet et al. [2], Kulis [17] for surveys.

All these metrics are global. They apply a single linear geometry to the entire input space, yet in real data the relevant features, their correlations and the noise level can depend on the region. A feature that separates two classes in one part of the space may be pure noise elsewhere. Locally adaptive rules address this. DANN [13] and the method of Domeniconi et al. [11] reshape the neighbourhood of each query from local statistics. Multi-metric LMNN [27] learns one metric per class or cluster. Parametric local metric learning (PLML, 26) combines basis metrics anchored in the input space with manifold regularisation. Adaptive neighbourhood sizes form a related line of work [18, 20].

Question. Can we learn, jointly, a local metric field, its smoothness and its robustness, while keeping the complexity of the learned object under explicit mathematical control? And does local adaptivity actually help on standard benchmarks once every competitor is tuned with the same care? We study these questions with an evolutionary approach. The optimisation problem combines non-convex, non-differentiable-looking terms (margins, minima over training points) with box constraints, and a GA handles it without gradients.

References (27)