tokens: The batch metric learning models can further be divided into two categories : models based on nearest neighbors , such as optimizes the expected leave - one - out error of a stochastic nearest classifier in the projection space and proposes the most widely - used Mahalanohis distance learning Large Margin Nearest Neighbors ( LMNN ) , i.e. , learning a Mahalanobis distance metric for NN classification for labeled training examples ; models based on pairs / triplets , for instance , searches for a clustering that puts the similar pairs into the same clusters and dissimilar pairs into different clusters ; promotes input sparsity by imposing a group sparsity penalty on the learned metric and a trace constraint to encourage output sparsity ; proposes a novel low - rank metric learning algorithm to yield bilinear similarity functions which can be applicable to high - dimensional data domains .