metric-learn

metric-learn provides Python implementations of metric learning algorithms.

github.com/metric-learn/metric-learn
metric-learn homepage screenshot

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
Best for: Python developers and machine learning researchers who want to apply metric learning algorithms within scikit-learn workflows.
Good for
  • 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
Watch out for
  • 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.

All 24 alternatives

Popular in ML Training & Optimization

Well-known listings from the same topic.

All 75

metric-learn FAQ

How can metric-learn be installed?
It can be installed with conda install -c conda-forge metric-learn, with pip install metric-learn from PyPI, or manually from the source repository by running python setup.py install.
Which Python versions are supported?
The library requires Python 3.6 or later. The last version that supported Python 2 and Python 3.5 was v0.5.0.
How should metric-learn be cited?
The authors ask that scientific publications cite metric-learn: Metric Learning Algorithms in Python, published in the Journal of Machine Learning Research, volume 21, 2020.
Is something wrong or out of date?

Tell us and an editor will check it.

Own this website?

Claim the listing and suggest updates yourself. An editor checks every claim first.

Claim this listing