Skip to contentScholarGate
LibraryBookshelfDeskReview StudioAssistant
Sign in
On this page
IntuitionHow it worksWhen to use itStrengths & limitationsCommon pitfallsApplicationsFrequently asked🔒 Read the full methodSourcesRelated methods
Cite this pageSpotted an issue on this page? Report or suggest a fix →
Home›Machine learning›Metric Learning
Machine learningMachine learning

Metric Learning

Metric Learning (Distance Metric Learning) · Also known as: Distance Metric Learning, Similarity Learning, DML, Representation Learning via Distance

Metric learning is a machine-learning framework that trains a distance or similarity function from data so that semantically similar examples end up close together in the learned space while dissimilar examples are pushed apart. Unlike fixed distances such as Euclidean, the learned metric adapts to the structure of the task, making downstream classifiers, clusterers, and retrieval systems significantly more accurate.

ScholarGate
  1. Machine learning
  2. v1
  3. 2 Sources
  4. PUBLISHED
Cite this page →
Tools & resources
Download slides
Learn & explore

Read the full method

Members only

Sign in with a free account to read this section.

Sign in

Method map

The neighbourhood of related methods — select a node to explore.

Metric Learning
Few-shot LearningGaussian ProcessSelf-supervised LearningSemi-supervised LearningTransfer LearningBayesian Metric LearningEnsemble Metric LearningOnline Metric LearningRegularized Transfer Lea…Robust Metric Learning

+4 more

When to use it

Use metric learning when the downstream task is inherently similarity-based — e.g., few-shot classification, face verification, medical image retrieval, speaker identification, or product recommendation — and when a fixed Euclidean distance performs poorly because features have unequal relevance. It excels with moderate-to-large labeled datasets and high-dimensional inputs such as images or text embeddings. Avoid it when you have very few labeled examples per class (fewer than about 5–10 per class), when the final goal is a simple tabular regression or classification well served by logistic regression or gradient boosting, or when interpretability in terms of explicit feature coefficients is required.

Strengths & limitations

Strengths
  • Adapts the geometry of the feature space to the specific task, substantially boosting nearest-neighbor and clustering accuracy.
  • Enables few-shot recognition: once a good metric is learned, classifying new classes requires only a handful of examples.
  • Transfers well across domains — a metric learned on one dataset can be fine-tuned for a related task with little additional data.
  • Model-agnostic: the learned embedding can feed any downstream algorithm (k-NN, SVM, k-means) without retraining those components.
  • Contrastive and triplet formulations scale to very large datasets via mini-batch sampling.
Limitations
  • Triplet and contrastive losses require careful pair/triplet mining; random sampling yields mostly easy, uninformative pairs and slows training drastically.
  • Linear Mahalanobis methods scale quadratically with feature dimensionality, becoming prohibitive in very high dimensions without dimensionality reduction.
  • Requires labeled or pairwise-constraint data; fully unsupervised settings limit what can be learned without additional assumptions.
  • Evaluation is indirect — metric quality must be assessed through a downstream task, not a single loss value.

Frequently asked

What is the difference between metric learning and contrastive learning?

Contrastive learning is a specific family of metric learning objectives (e.g., contrastive loss, SimCLR) that contrast positive and negative pairs. Metric learning is the broader framework that also includes Mahalanobis methods, triplet losses, and proxy-based objectives.

How many examples per class do I need?

Linear Mahalanobis methods can work with as few as 10–20 examples per class. Deep metric learning generally requires tens to hundreds of examples per class to learn useful embeddings, though pre-trained backbones can reduce this requirement substantially.

Is metric learning the same as dimensionality reduction?

Not exactly. Methods like PCA or UMAP reduce dimensions without direct supervision. Metric learning uses class or pairwise supervision to shape the geometry, so the resulting space is task-discriminative, not just compact.

Can metric learning handle imbalanced classes?

Yes, but pair/triplet sampling must be stratified to avoid the dominant class overwhelming the batch. Proxy-based losses (Proxy-NCA, Proxy-Anchor) are more robust to class imbalance than triplet sampling.

When should I use metric learning instead of a standard classifier?

Prefer metric learning when you need to generalize to classes unseen at training time (open-set recognition, few-shot learning), or when the task is retrieval rather than fixed-class prediction.

Sources

  1. Xing, E. P., Jordan, M. I., Russell, S., & Ng, A. Y. (2003). Distance metric learning with application to clustering with side-information. In Advances in Neural Information Processing Systems (NIPS), 16, 505–512. link ↗
  2. Weinberger, K. Q., & Saul, L. K. (2009). Distance metric learning for large margin nearest neighbor classification. Journal of Machine Learning Research, 10, 207–244. link ↗

How to cite this page

ScholarGate. (2026, June 3). Metric Learning (Distance Metric Learning). ScholarGate. https://scholargate.app/en/machine-learning/metric-learning

Related methods

Few-shot LearningGaussian ProcessSelf-supervised LearningSemi-supervised LearningTransfer Learning

Which method?

Set this method beside its closest kin and read them side by side — the library lays the books on the table; the choice is yours.

  • Few-shot LearningMachine learning↔ compare
  • Gaussian ProcessMachine learning↔ compare
  • Self-supervised LearningMachine learning↔ compare
  • Semi-supervised LearningMachine learning↔ compare
  • Transfer LearningMachine learning↔ compare
Compare side by side →

Referenced by

Bayesian Metric LearningEnsemble Metric LearningFew-shot LearningOnline Metric LearningRegularized Transfer LearningRobust Metric LearningSelf-supervised K-nearest neighborsSelf-supervised Metric learningSelf-supervised Transfer learningSemi-supervised Metric Learning

Similar methods

Self-supervised Metric learningEnsemble Metric LearningRobust Metric LearningSemi-supervised Metric LearningBayesian Metric LearningOnline Metric LearningSiamese NetworkFew-shot Learning

Related reference concepts

Dimensionality ReductionSupport Vector ClassificationSelf-Supervised and Representation LearningUnsupervised LearningMultidimensional ScalingSupport Vector Machines and Kernel Methods

Spotted an issue on this page? Report or suggest a fix →

ScholarGate — Metric Learning (Metric Learning (Distance Metric Learning)). Retrieved 2026-07-21 from https://scholargate.app/en/machine-learning/metric-learning · Dataset: https://doi.org/10.5281/zenodo.20539026
Quick facts
Originator
Xing, E. P.; Jordan, M. I.; Russell, S.; Ng, A. Y.
Year
2003 (foundational); refined 2009 (LMNN)
Type
Representation learning / supervised distance optimization
DataType
Labeled or pairwise-constrained numerical and embedding data
Subfamily
Machine learning
Related methods
Few-shot LearningGaussian ProcessSelf-supervised LearningSemi-supervised LearningTransfer Learning
ScholarGate

A content-first reference library for research methods — what each one is, how it works, and where it comes from.

Open data (CC-BY)

Explore

  • Library
  • Search the library…
  • Browse by field
  • Fields
  • Journey
  • Compare
  • Which method?

Reference

  • Subjects
  • Atlas
  • Glossary
  • Methodology
  • Philosophy

Your tools

  • Bookshelf
  • Desk
  • Chat

Company

  • About
  • Pricing
  • Contact
  • Suggest a method

Entries are compiled from published sources for reference. Verifying the accuracy and suitability of any information for your own use remains your responsibility.

© 2026 ScholarGate · A research-method reference library
  • Privacy
  • Cookies
  • Terms
  • Delete account