{"data":{"slug":"scikit-learn-contrib-metric-learn","name":"metric-learn","tagline":"Metric learning algorithms in Python","github_url":"https://github.com/scikit-learn-contrib/metric-learn","owner":"scikit-learn-contrib","repo":"metric-learn","owner_avatar_url":"https://avatars.githubusercontent.com/u/17349883?v=4","primary_language":"Python","stars":1431,"forks":232,"topics":["machine-learning","metric-learning","python","scikit-learn"],"archived":false,"github_pushed_at":"2026-03-19T21:11:11+00:00","maintenance_label":"Slowing","stars_delta_30d":-7,"url":"https://www.graphcanon.com/tools/scikit-learn-contrib-metric-learn","markdown_url":"https://www.graphcanon.com/tools/scikit-learn-contrib-metric-learn.md","api_url":"https://www.graphcanon.com/api/graphcanon/tools/scikit-learn-contrib-metric-learn","graph_url":"https://www.graphcanon.com/api/graphcanon/graph?tool=scikit-learn-contrib-metric-learn","description":"Metric learning algorithms in Python","homepage_url":"http://contrib.scikit-learn.org/metric-learn/","license":"MIT","open_issues":51,"watchers":42,"ai_summary":"metric-learn contains efficient Python implementations of several metric learning algorithms compatible with scikit-learn's API.","readme_excerpt":"|GitHub Actions Build Status| |License| |PyPI version| |Code coverage|\n\nmetric-learn: Metric Learning in Python\n=======================================\n\nmetric-learn contains efficient Python implementations of several popular supervised and weakly-supervised metric learning algorithms. As part of `scikit-learn-contrib <https://github.com/scikit-learn-contrib>`_, the API of metric-learn is compatible with `scikit-learn <http://scikit-learn.org/stable/>`_, the leading library for machine learning in Python. This allows to use all the scikit-learn routines (for pipelining, model selection, etc) with metric learning algorithms through a unified interface.\n\n**Algorithms**\n\n-  Large Margin Nearest Neighbor (LMNN)\n-  Information Theoretic Metric Learning (ITML)\n-  Sparse Determinant Metric Learning (SDML)\n-  Least Squares Metric Learning (LSML)\n-  Sparse Compositional Metric Learning (SCML)\n-  Neighborhood Components Analysis (NCA)\n-  Local Fisher Discriminant Analysis (LFDA)\n-  Relative Components Analysis (RCA)\n-  Metric Learning for Kernel Regression (MLKR)\n-  Mahalanobis Metric for Clustering (MMC)\n\n**Dependencies**\n\n-  Python 3.6+ (the last version supporting Python 2 and Python 3.5 was\n   `v0.5.0 <https://pypi.org/project/metric-learn/0.5.0/>`_)\n-  numpy>= 1.11.0, scipy>= 0.17.0, scikit-learn>=0.21.3\n\n**Optional dependencies**\n\n- For SDML, using skggm will allow the algorithm to solve problematic cases\n  (install from commit `a0ed406 <https://github.com/skggm/skggm/commit/a0ed406586c4364ea3297a658f415e13b5cbdaf8>`_).\n  ``pip install 'git+https://github.com/skggm/skggm.git@a0ed406586c4364ea3297a658f415e13b5cbdaf8'`` to install the required version of skggm from GitHub.\n-  For running the examples only: matplotlib\n\n**Installation/Setup**\n\n- If you use Anaconda: ``conda install -c conda-forge metric-learn``. See more options `here <https://github.com/conda-forge/metric-learn-feedstock#installing-metric-learn>`_.\n\n- To install from PyPI: ``pip install metric-learn``.\n\n- For a manual install of the latest code, download the source repository and run ``python setup.py install``. You may then run ``pytest test`` to run all tests (you will need to have the ``pytest`` package installed).\n\n**Usage**\n\nSee the `sphinx documentation`_ for full documentation about installation, API, usage, and examples.\n\n**Citation**\n\nIf you use metric-learn in a scientific publication, we would appreciate\ncitations to the following paper:\n\n`metric-learn: Metric Learning Algorithms in Python\n<http://www.jmlr.org/papers/volume21/19-678/19-678.pdf>`_, de Vazelhes\n*et al.*, Journal of Machine Learning Research, 21(138):1-6, 2020.\n\nBibtex entry::\n\n  @article{metric-learn,\n    title = {metric-learn: {M}etric {L}earning {A}lgorithms in {P}ython},\n    author = {{de Vazelhes}, William and {Carey}, CJ and {Tang}, Yuan and\n              {Vauquier}, Nathalie and {Bellet}, Aur{\\'e}lien},\n    journal = {Journal of Machine Learning Research},\n    year = {2020},\n    volume = {21},\n    number = {138},\n    pages = {1--6}\n  }\n\n.. _sphinx documentation: http://contrib.scikit-learn.org/metric-learn/\n\n.. |GitHub Actions Build Status| image:: https://github.com/scikit-learn-contrib/metric-learn/workflows/CI/badge.svg\n   :target: https://github.com/scikit-learn-contrib/metric-learn/actions?query=event%3Apush+branch%3Amaster\n.. |License| image:: http://img.shields.io/:license-mit-blue.svg?style=flat\n   :target: http://badges.mit-license.org\n.. |PyPI version| image:: https://badge.fury.io/py/metric-learn.svg\n   :target: http://badge.fury.io/py/metric-learn\n.. |Code coverage| image:: https://codecov.io/gh/scikit-learn-contrib/metric-learn/branch/master/graph/badge.svg\n   :target: https://codecov.io/gh/scikit-learn-contrib/metric-learn","github_created_at":"2013-11-02T08:29:47+00:00","created_at":"2026-07-11T23:23:52.683498+00:00","updated_at":"2026-09-26T06:00:47.124915+00:00","categories":[{"slug":"model-training","name":"Model Training","url":"https://www.graphcanon.com/categories/model-training","markdown_url":"https://www.graphcanon.com/categories/model-training.md","api_url":"https://www.graphcanon.com/api/graphcanon/categories/model-training"}],"tags":[{"slug":"machine-learning","name":"machine-learning"},{"slug":"metric-learning","name":"metric-learning"},{"slug":"python","name":"python"},{"slug":"scikit-learn","name":"scikit-learn"}],"trust":{"provenance":{"is_fork":false,"github_id":14063354,"owner_type":"Organization","methodology":"github_public_v1","parent_repo":null,"near_duplicate_slugs":[]},"computed_at":"2026-09-26T06:00:46.381Z","maintenance":{"label":"Slowing","score":36,"methodology":"github_public_v1","releases_90d":0,"days_since_push":190,"last_release_at":"2023-09-29T00:16:16Z","stars_delta_30d":-7,"open_issues_delta_30d":0},"security_summary":{"status":"no_lockfile","scanner":null,"low_count":0,"high_count":0,"last_scan_at":"2026-07-11T23:24:00.258Z","medium_count":0,"scan_profile":"none","critical_count":0}},"capability_facts":{"scan":{"source":"repo_scan","observed_at":"2026-09-26T06:00:46.818Z"},"languages":{"value":["python"],"source":"github.language","observed_at":"2026-09-26T06:00:46.818Z"},"license_spdx":{"value":"MIT","source":"github.license","observed_at":"2026-09-26T06:00:46.818Z"}},"decision_facts":{"hosting":null,"pricing":null,"requirements":{"notes":["The application requires Python version 3.6 or higher and specific dependencies such as numpy, scipy, and scikit-learn."],"min_ram_gb":null,"requires_docker":false},"constraints":{"min_ram_gb":null,"requires_docker":false},"when_to_use":["When you need to use specific metric learning techniques such as Large Margin Nearest Neighbor (LMNN) or Neighborhood Components Analysis (NCA), which are implemented efficiently in Python.","When your project is compatible with the scikit-learn framework and you want to integrate new methods without changing existing pipelines."],"when_not_to_use":["If your development environment does not already use Python, as metric-learn is specific to this language and its ecosystem.","For applications that require real-time performance critical operations, since the library may rely on computationally intensive algorithms that could affect latency in real-time systems."],"source":"enrich:decision_facts","observed_at":"2026-07-17T01:21:59.821Z"},"constraint_facets":{"min_ram_gb":null,"requires_docker":false},"decision_summary":[{"label":"Requirements","value":"The application requires Python version 3.6 or higher and specific dependencies such as numpy, scipy, and scikit-learn."},{"label":"Adopt for","value":"Metric-learn is a Python library for metric learning that offers a range of algorithms compatible with scikit-learn's API and supports various methods like LMNN, ITML, LFDA among others."}]}}