Metric¶
Core Idea¶
A metric is a rule assigning a non-negative distance to every pair of objects in a set, subject to three axioms: the distance is zero exactly when the objects coincide, it is symmetric, and it obeys the triangle inequality. These three constraints turn a vague sense of "closeness" into a structure with stable, exploitable properties.
How would you explain it like I'm…
The Distance Rule
Distance With Three Rules
Axioms Of Distance
Broad Use¶
- Geography: Euclidean distance on a map, great-circle distance on a sphere, road-network distance through a graph.
- Information theory: Hamming distance between binary strings, edit distance between texts.
- Machine learning: Euclidean, Mahalanobis, and cosine distance between feature vectors, where the metric determines what "similar" means for clustering and retrieval.
- Semantics: distances in an embedding space encode meaning proximity for words and images.
- Political science: ideological distance between voters, preference distance between consumers.
- Biology: phylogenetic and genetic distance between organisms.
Clarity¶
The three axioms make explicit what "close" means, revealing that the choice of distance is a substantive modeling decision — and that two analysts disputing whether things are "similar" are usually disputing which metric to apply.
Manages Complexity¶
The triangle inequality lets whole regions of a search space be pruned without examination, making nearest-neighbour search, hierarchical clustering, and metric indexing tractable at scale.
Abstract Reasoning¶
Once distance is axiomatized, an enormous library of theorems — convergence, completeness, contraction, fixed points — becomes available substrate-free, holding in every concrete metric space.
Knowledge Transfer¶
- Clustering: change the metric (cosine, Mahalanobis, edit distance) and the clustering behaviour changes predictably.
- Search: exploit the triangle inequality to prune, identically whether objects are map points or embeddings.
- Asymmetric resemblance: when similarity is genuinely directional, drop symmetry and move to a divergence — recognizing the metric machinery no longer applies.
Example¶
A music-recommendation system represents each song as a feature vector: under Euclidean distance two songs are close when their absolute loudness matches, but under cosine distance two are close when their feature profiles align — so a quiet cover and a loud band version land close under cosine and far apart under Euclidean. The team's disagreement about recommendations is structurally a disagreement about the metric.
Relationships to Other Abstractions¶
Current abstraction Metric Prime
Parents (1) — more general patterns this builds on
-
Metric is a kind of Function (Mapping) Prime
Every Metric is a Function Mapping from ordered pairs of objects to non-negative real distances, with metric axioms added.
Children (22) — more specific cases that build on this
-
Banach–Mazur compactum Domain-specific is a kind of Metric
The proposed strict upward parent is
prime:metric. -
Bandwidth-delay product Domain-specific is a kind of Metric
The proposed strict upward parent is
prime:metric. -
BK-tree Domain-specific is a kind of Metric
The proposed strict upward parent is
prime:metric. -
Contact order Domain-specific is a kind of Metric
The proposed strict upward parent is
prime:metric. -
Diamond norm Domain-specific is a kind of Metric
The proposed strict upward parent is
prime:metric.
- Distance (graph theory) Domain-specific is a kind of Metric
The proposed strict upward parent is `prime:metric`.
- Haversine Formula Domain-specific is a kind of Metric
The formula **specializes Metric**: its output is the geodesic distance on a sphere expressed through one coordinate relation.
- Hedgehog Space Domain-specific is a kind of Metric
**Metric** is the proposed immediate parent.
- Karlsruhe Metric Domain-specific is a kind of Metric
The Karlsruhe Metric strictly instantiates **Metric** (`prime:metric`).
- Lévy–Prokhorov metric Domain-specific is a kind of Metric
The proposed strict upward parent is `prime:metric`.
- P-adic number Domain-specific is a kind of Metric
The proposed strict upward parent is `prime:metric`.
- Ultrametric space Domain-specific is a kind of Metric
The proposed strict upward parent is `prime:metric`.
- Wiener index Domain-specific is a kind of Metric
The proposed strict upward parent is `prime:metric`.
- Angular Diameter Distance Domain-specific is part of Metric
**`metric`:** (D_A) is an operational cosmological distance measure.
- Correlation Dimension Domain-specific presupposes Metric
**Dimension** is instantiated as the sought scaling exponent.
- Diffeomorphometry Domain-specific is part of Metric
Diffeomorphometry instantiates **Metric** most directly: it constructs a distance on anatomical forms from geodesic lengths or energies on a diffeomorphism group.
- Equilateral Dimension Domain-specific presupposes Metric
Equilateral Dimension **instantiates `prime:cardinality` by strict subsumption**.
- Euclidean Space Domain-specific is part of Metric
Euclidean Space **presupposes `prime:vector_space`**.
- Hamming Scheme Domain-specific presupposes Metric
The accepted reference-grade review places Hamming Scheme under Metric because the child instantiates or depends on the parent's broader structure while retaining its own constitutive identity.
- Hyper-Wiener Index Domain-specific presupposes Metric
Hyper-Wiener Index **instantiates `prime:aggregation` by strict subsumption**.
- Laakso Space Domain-specific presupposes Metric
**Measure** is presupposed by Ahlfors regularity and the Poincaré inequality.
- Reach (Mathematics) Domain-specific presupposes Metric
**Metric — prospective strict parent (composition / presupposes).** Reach literally requires ambient Euclidean distance, distance-to-set, and metric balls.
Hierarchy path (1) — routes to 1 parentless root
- Metric → Function (Mapping)
Not to Be Confused With¶
- Metric is not Measure because a metric attaches distance to pairs and obeys the triangle inequality, whereas a measure attaches additive size to subsets and obeys additivity over disjoint parts; closeness is not bigness.
- Metric is not a Divergence because a metric requires symmetry, whereas a divergence (KL, asymmetric error cost) is genuinely directional and the triangle-inequality theorems no longer apply.
- Metric is not Commensurability because a metric presupposes its objects already share a common scale, whereas commensurability is the prior question of whether they can be placed on one scale at all.