Semi-supervised Metric Learning
Also known as: SSML, semi-supervised distance learning, constrained metric learning, weakly supervised metric learning
Semi-supervised metric learning learns a task-adapted distance function by combining a small set of labeled pairwise constraints — must-link and cannot-link pairs — with the geometric structure of a much larger pool of unlabeled data. The result is a Mahalanobis-style or kernel-based distance that reflects both supervision and data topology, improving downstream tasks such as nearest-neighbor classification and clustering.
Read the full method
Sign in with a free account to read this section.
Method map
The neighbourhood of related methods — select a node to explore.
When to use it
Use semi-supervised metric learning when labeled data is scarce but unlabeled data is abundant, and the downstream task depends critically on a good notion of similarity — such as kNN classification, retrieval, clustering, or few-shot learning. It is especially valuable in domains where annotation is costly: medical imaging, molecular biology, document retrieval. Avoid it when you have abundant labels (fully supervised metric learning is simpler and stronger), when the unlabeled pool is small or unrepresentative (manifold assumptions break down), or when the data dimensionality is very high without appropriate kernel or sparse regularization, since the Mahalanobis matrix estimation becomes ill-conditioned.
Strengths & limitations
- Dramatically reduces the need for fully labeled data by exploiting unlabeled structure.
- Learned distance improves kNN, clustering, and retrieval beyond Euclidean baselines.
- Pairwise constraints are easier to collect than full class labels in many annotation pipelines.
- Convex formulations (e.g., information-theoretic metric learning) guarantee global optima.
- Works in the original feature space or in kernelized / embedding spaces.
- Quality depends on the manifold regularity assumption: if unlabeled data is noisy or unrepresentative, propagated structure misleads the metric.
- High-dimensional settings require regularization or low-rank constraints to keep the Mahalanobis matrix tractable.
- Scalability is limited; exact optimization over large pairwise constraint sets and large kernel matrices can be expensive.
- Constraint quality matters: noisy or inconsistent must-link / cannot-link labels degrade performance.
Frequently asked
How many pairwise constraints are typically needed?
Even a few dozen to a few hundred constraints can yield meaningful improvement over Euclidean distance, especially when unlabeled data is plentiful. Performance typically saturates after a few thousand constraints.
How does this differ from purely supervised metric learning?
Purely supervised metric learning (e.g., LMNN) optimizes only on labeled triplets or pairs. Semi-supervised metric learning also incorporates the geometry of unlabeled examples as a regularizer, often enabling better generalization with far fewer labels.
Can deep neural networks be used as the backbone?
Yes. Deep semi-supervised metric learning trains an encoder using contrastive or triplet losses on labeled pairs while using self-supervised pretext tasks or pseudo-labels to leverage unlabeled data, combining both paradigms.
What evaluation metric should I use?
For retrieval: mean Average Precision (mAP) or Recall@k. For kNN classification: accuracy and F1 under leave-one-out evaluation. For clustering: NMI and ARI on a held-out labeled subset.
When is it better to just use self-supervised or transfer learning instead?
If you have access to a large pretrained model and your domain is not too distant from the pretraining data, transfer learning or self-supervised pretraining often outperforms SSML because they scale better with unlabeled data and do not require explicit pairwise annotation.
Sources
- Yeung, D.-Y., & Chang, H. (2007). A kernel approach for semi-supervised metric learning. IEEE Transactions on Neural Networks, 18(1), 141–149. DOI: 10.1109/TNN.2006.883723 ↗
- Davis, J. V., & Dhillon, I. S. (2008). Structured metric learning for high dimensional problems. Proceedings of the 14th ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, 195–203. DOI: 10.1145/1401890.1401918 ↗
How to cite this page
ScholarGate. (2026, June 3). Semi-supervised Metric Learning. ScholarGate. https://scholargate.app/en/machine-learning/semi-supervised-metric-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
- Metric LearningMachine learning↔ compare
- Self-supervised LearningMachine learning↔ compare
- Semi-supervised LearningMachine learning↔ compare
- Transfer LearningMachine learning↔ compare