Goal: embed discrete objects into metric space
Euclidean distance: $\displaystyle d(x,y) = ||x-y||_2$
Mahalanabos distance: $\displaystyle d(x,y) = \sqrt{(x-y)^TS^{-1}(x-y)}$
Mahalanobis distanc emetric learning: $\displaystyle d(x,y)= d_A(x,y) = ||x-y||_A = \sqrt{(x-y)^TA^{-1}(x-y)}$
$$\min_A \sum_{(x_i.x_j)\in \text{similar}} ||x_i - x_j||_A^2$$
Constraints: $$\displaystyle \sum_{(x_i,x_j)\in \text{dissimilar}} ||x_i-x_j||_A^2 \ge 1 \\ A \ge 0$$
Note that $A$ has to be positive semi-definite ($A\ge0$) because otherwise, there might be some negative distances (invalid)
In [2]:
Image(filename="figs/metricleanring-embedding.png")
In [ ]: