Welcome to pyDML’s documentation!¶
The need of a similarity measure is very common in many machine learning algorithms, such as nearest neighbors classification. Usually, a standard distance, like the euclidean distance, is used to measure this similarity. The distance metric learning paradigm tries to learn an optimal distance from the data. This package provides the classic algorithms of supervised distance metric learning, together with some of the newest proposals.
How to learn a distance?¶
There are two main ways to learn a distance in Distance Metric Learning:
- Learning a metric matrix M, that is, a positive semidefinite matrix. In this case, the distance is measured as
\[d(x,y) = \sqrt{(x-y)^TM(x-y)}.\]
- Learning a linear map L. This map is also represented by a matrix, not necessarily definite or squared. Here, the distance between two elements is the euclidean distance after applying the transformation.
Every linear map defines a single metric (\(M = L^TL\)), and two linear maps that define the same metric only differ in an isometry. So both approaches are equivalent.
Current Algorithms:
- Principal Component Analysis (PCA)
- Linear Discriminant Analysis (LDA)
- Average Neighborhood Margin Maximization (ANMM)
- Local Linear Discriminant Analysis (LLDA)
- Large Margin Nearest Neighbors (LMNN)
- Neighborhood Component Analysis (NCA)
- Nearest Class Mean Metric Learning (NCMML)
- Nearest Class with Multiple Centroids (NCMC)
- Information Theoretic Metric Learning (ITML)
- Distance Metric Learning through the Maximization of the Jeffrey Divergence (DMLMJ)
- Maximally Collapsing Metric Learning (MCML)
- Learning with Side Information (LSI)
- Distance Metric Learning with Eigenvalue Optimization (DML-eig)
- Logistic Discriminant Metric Learning (LDML)
- Kernel Large Margin Nearest Neighbors (KLMNN)
- Kernel Average Neighborhood Margin Maximization (KANMM)
- Kernel Distance Metric Learning through the Maximization of the Jeffrey divergence (KDMLMJ)
- Kernel Discriminant Analysis (KDA)
- Kernel Local Linear Discriminant Analysis (KLLDA)
Additional functionalities