{"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":1437,"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","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":null,"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-07-12T02:45:31.089039+00:00","categories":[{"slug":"llm-frameworks","name":"LLM Frameworks","url":"https://www.graphcanon.com/categories/llm-frameworks","markdown_url":"https://www.graphcanon.com/categories/llm-frameworks.md","api_url":"https://www.graphcanon.com/api/graphcanon/categories/llm-frameworks"},{"slug":"computer-vision","name":"Computer Vision","url":"https://www.graphcanon.com/categories/computer-vision","markdown_url":"https://www.graphcanon.com/categories/computer-vision.md","api_url":"https://www.graphcanon.com/api/graphcanon/categories/computer-vision"}],"tags":[{"slug":"machine-learning","name":"machine-learning"},{"slug":"python","name":"python"},{"slug":"scikit-learn","name":"scikit-learn"},{"slug":"metric-learning","name":"metric-learning"}],"trust":{"provenance":{"is_fork":false,"github_id":14063354,"owner_type":"Organization","methodology":"github_public_v1","parent_repo":null,"near_duplicate_slugs":[]},"computed_at":"2026-07-11T23:23:59.795Z","maintenance":{"label":"Slowing","score":36,"methodology":"github_public_v1","releases_90d":0,"days_since_push":114,"last_release_at":"2023-09-29T00:16:16Z"},"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-07-11T23:23:59.558Z"},"languages":{"value":["python"],"source":"github.language","observed_at":"2026-07-11T23:23:59.558Z"},"license_spdx":{"value":"MIT","source":"github.license","observed_at":"2026-07-11T23:23:59.558Z"}}}}