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

About metric-learn
metric-learn is an open-source Python library that provides implementations of supervised and weakly-supervised metric learning algorithms. It is part of scikit-learn-contrib, and its API is designed to be compatible with scikit-learn. This allows scikit-learn routines for pipelining and model selection to be used with metric learning algorithms through a unified interface.
The library includes ten named algorithms. It requires Python 3.6 or later, along with numpy, scipy, and scikit-learn at specified minimum versions. The optional skggm package can be used with the SDML algorithm, and running the examples requires matplotlib. The library can be installed through conda-forge, PyPI, or from source. The authors ask that scientific publications using metric-learn cite their 2020 paper in the Journal of Machine Learning Research.
Key features
- Implements ten supervised and weakly-supervised metric learning algorithms, including LMNN, ITML, and NCA
- scikit-learn compatible API for use with pipelining and model selection routines
- Optional skggm integration for SDML to address problematic cases
- Installable via conda-forge, PyPI, or manual installation from source code
- Example scripts that require matplotlib to run
- Works with scikit-learn routines for pipelining and model selection through a unified interface
- Provides ten metric learning algorithms in one Python package
- Distributed as open source under the MIT license
- Requires Python 3.6 or later and specific minimum versions of numpy, scipy, and scikit-learn
- The optional skggm enhancement for SDML must be installed from a specific GitHub commit
- Running the examples requires matplotlib, which is not listed as a core dependency
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 6, 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
How can metric-learn be installed?
Which Python versions are supported?
How should metric-learn be cited?
Tell us and an editor will check it.
Claim the listing and suggest updates yourself. An editor checks every claim first.












