The Hassanat Distance (HasD) is a bounded, non-convex metric widely used in
k-nearest-neighbor (KNN) classification for its robustness to noise, outliers, and heterogeneous feature scales. Its definition, however, breaks a natural symmetry: through a sign-dependent shift it assigns different distances to mirror-image
[...] Read more.
The Hassanat Distance (HasD) is a bounded, non-convex metric widely used in
k-nearest-neighbor (KNN) classification for its robustness to noise, outliers, and heterogeneous feature scales. Its definition, however, breaks a natural symmetry: through a sign-dependent shift it assigns different distances to mirror-image pairs such as
and
, distorting neighborhoods exactly in the value ranges that modern preprocessing (
z-scoring, principal component analysis (PCA), learned embeddings) produces. We introduce the Sign-Symmetric Hassanat Distance (SHasD), a single branch-free formula
that is invariant under the reflection
, coincides exactly with HasD on non-negative data, and removes the conditional shift entirely. We prove SHasD is a metric, and we derive a range-normalized companion, SHasD-R, that additionally restores ray monotonicity and the
per-dimension bound. On 23 datasets across three normalization regimes and ten distance measures, SHasD improves significantly on HasD on data containing negative values (mean gain
percentage points, up to
; Wilcoxon
, Holm-corrected) and attains the best mean rank of the compared measures on signed, heavy-tailed, outlier-rich data, while preserving HasD’s robustness. An additive per-dimension decomposition yields a built-in interpretation of every prediction.
Full article