metric-learn

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

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

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
Best for: Python developers and researchers who need plug-in metric learning algorithms that work with existing scikit-learn workflows.
Good for
  • 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
Watch out for
  • 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.

All 24 alternatives

Popular in ML Training & Optimization

Well-known listings from the same topic.

All 75

metric-learn FAQ

Which metric learning algorithms does metric-learn provide?
Large Margin Nearest Neighbor, Information Theoretic Metric Learning, Sparse Determinant Metric Learning, Least Squares Metric Learning, Sparse Compositional Metric Learning, Neighborhood Components Analysis, Local Fisher Discriminant Analysis, Relative Components Analysis, Metric Learning for Kernel Regression, and Mahalanobis Metric for Clustering.
How is metric-learn installed?
With Anaconda via conda install -c conda-forge metric-learn, from PyPI via pip install metric-learn, or manually by downloading the source and running python setup.py install.
What dependencies does it need?
Python 3.6 or later plus numpy>=1.11.0, scipy>=0.17.0 and scikit-learn>=0.21.3. skggm is optional for SDML and matplotlib is only needed to run the examples.
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