|
| 1 | +metric-learn: Metric Learning in Python |
| 2 | +======================================= |
| 3 | +|License| |PyPI version| |
| 4 | + |
| 5 | +Distance metrics are widely used in the machine learning literature. |
| 6 | +Traditionally, practicioners would choose a standard distance metric |
| 7 | +(Euclidean, City-Block, Cosine, etc.) using a priori knowledge of |
| 8 | +the domain. |
| 9 | +Distance metric learning (or simply, metric learning) is the sub-field of |
| 10 | +machine learning dedicated to automatically constructing optimal distance |
| 11 | +metrics. |
| 12 | + |
| 13 | +This package contains efficient Python implementations of several popular |
| 14 | +metric learning algorithms. |
| 15 | + |
| 16 | +.. toctree:: |
| 17 | + :caption: Algorithms |
| 18 | + :maxdepth: 1 |
| 19 | + |
| 20 | + metric_learn.lmnn |
| 21 | + metric_learn.itml |
| 22 | + metric_learn.sdml |
| 23 | + metric_learn.lsml |
| 24 | + metric_learn.nca |
| 25 | + metric_learn.lfda |
| 26 | + metric_learn.rca |
| 27 | + |
| 28 | +Each metric supports the following methods: |
| 29 | + |
| 30 | +- ``fit(...)``, which learns the model. |
| 31 | +- ``transformer()``, which returns a transformation matrix |
| 32 | + :math:`L \in \mathbb{R}^{D \times d}`, which can be used to convert a |
| 33 | + data matrix :math:`X \in \mathbb{R}^{n \times d}` to the |
| 34 | + :math:`D`-dimensional learned metric space :math:`X L^{\top}`, |
| 35 | + in which standard Euclidean distances may be used. |
| 36 | +- ``transform(X)``, which applies the aforementioned transformation. |
| 37 | +- ``metric()``, which returns a Mahalanobis matrix |
| 38 | + :math:`M = L^{\top}L` such that distance between vectors ``x`` and |
| 39 | + ``y`` can be computed as :math:`\left(x-y\right)M\left(x-y\right)`. |
| 40 | + |
| 41 | + |
| 42 | +Installation and Setup |
| 43 | +====================== |
| 44 | + |
| 45 | +Run ``pip install metric-learn`` to download and install from PyPI. |
| 46 | + |
| 47 | +Alternately, download the source repository and run: |
| 48 | + |
| 49 | +- ``python setup.py install`` for default installation. |
| 50 | +- ``python setup.py test`` to run all tests. |
| 51 | + |
| 52 | +**Dependencies** |
| 53 | + |
| 54 | +- Python 2.6+ |
| 55 | +- numpy, scipy, scikit-learn |
| 56 | +- (for running the examples only: matplotlib) |
| 57 | + |
| 58 | +**Notes** |
| 59 | + |
| 60 | +If a recent version of the Shogun Python modular (``modshogun``) library |
| 61 | +is available, the LMNN implementation will use the fast C++ version from |
| 62 | +there. The two implementations differ slightly, and the C++ version is |
| 63 | +more complete. |
| 64 | + |
| 65 | +Naviagtion |
| 66 | +---------- |
| 67 | + |
| 68 | +:ref:`genindex` | :ref:`modindex` | :ref:`search` |
| 69 | + |
| 70 | +.. toctree:: |
| 71 | + :maxdepth: 4 |
| 72 | + :hidden: |
| 73 | + |
| 74 | + Package Overview <metric_learn> |
| 75 | + |
| 76 | +.. |PyPI version| image:: https://badge.fury.io/py/metric-learn.svg |
| 77 | + :target: http://badge.fury.io/py/metric-learn |
| 78 | +.. |License| image:: http://img.shields.io/:license-mit-blue.svg?style=flat |
| 79 | + :target: http://badges.mit-license.org |
0 commit comments