metric-learn provides Python implementations of metric learning algorithms.
metric-learn
This metric-learn repository contains Python implementations of metric learning algorithms.

About metric-learn
metric-learn is a Python library of supervised and weakly-supervised metric learning algorithms, maintained as part of scikit-learn-contrib. It implements popular methods such as Large Margin Nearest Neighbor, Information Theoretic Metric Learning, Neighborhood Components Analysis, Local Fisher Discriminant Analysis and others behind a single interface.
Key features
- Implements LMNN, ITML, SDML, LSML, SCML, NCA, LFDA, RCA, MLKR and MMC
- scikit-learn-compatible API for pipelining and model selection
- Installable from PyPI, conda-forge, or manual source setup
- Requires Python 3.6+ and recent numpy, scipy, scikit-learn versions
- Optional skggm dependency helps SDML handle problematic cases
- MIT-licensed source with tests runnable via pytest
- Covers a broad set of supervised and weakly-supervised metric learning algorithms
- Unified scikit-learn-compatible interface for pipelining and model selection
- Available through PyPI, conda-forge and manual source installation
- Python 3.6+ required; Python 2 and 3.5 only supported up to v0.5.0
- SDML can need the optional skggm dependency for problematic cases
- Repository does not describe supported platforms or geographic availability
metric-learn at a glance
- Type
- Open-source project
- Pricing
- Not confirmed. Check the site
- Open source
- Yes · Source code
- Language
- English
- Last checked
- Oct 5, 2026 · Online when checked
- Listed
- Oct 5, 2026
metric-learn alternatives
Tools and sites you could use instead, ranked by how closely they match.
numpy-ml collects machine learning algorithms in NumPy, presented as an intentionally readable Python package.
hyperopt-sklearn uses hyperparameter optimization to select machine learning algorithms for scikit-learn.
Karate Club offers algorithms for unsupervised learning on graph data in Python.
BayesO provides a Python package for Bayesian optimization algorithms and related modeling tasks.
pomegranate provides flexible probabilistic modeling tools and algorithms for Python users.
Popular in ML Training & Optimization
Well-known listings from the same topic.
metric-learn FAQ
Which metric learning algorithms does metric-learn provide?
How is metric-learn installed?
What dependencies does it need?
Tell us and an editor will check it.
Claim the listing and suggest updates yourself. An editor checks every claim first.












