Similarity learning

From Wikipedia, the free encyclopedia
Jump to: navigation, search

Similarity learning is an area of supervised machine learning in artificial intelligence. It is closely related to regression and classification, but the goal is to learn from examples a similarity function that measures how similar or related two objects are. It has applications in ranking, in recommendation systems, visual identity tracking, face verification, and speaker verification.

Learning setup[edit]

There are four common setups for similarity and metric distance learning.

Regression similarity learning
In this setup, pairs of objects are given together with a measure of their similarity . The goal is to learn a function that approximates for every new labeled triplet example . This is typically achieved by minimizing a regularized loss .
Classification similarity learning
Given are pairs of similar objects and non similar objects . An equivalent formulation is that every pair is given together with a binary label that determines if the two objects are similar or not. The goal is again to learn a classifier that can decide if a new pair of objects is similar or not.
Ranking similarity learning
Given are triplets of objects whose relative similarity obey a predefined order: is known to be more similar to than to . The goal is to learn a function such that for any new triplet of objects , it obeys . This setup assumes a weaker form of supervision than in regression, because instead of providing an exact measure of similarity, one only has to provide the relative order of similarity. For this reason, ranking-based similarity learning is easier to apply in real large scale applications.[1]
Locality sensitive hashing (LSH)[2]
hashes input items so that similar items map to the same "buckets" in memory with high probability (the number of buckets being much smaller than the universe of possible input items). It is often applied in nearest neighbor search on large scale high-dimensional data, e.g., image databases, document collections, time-series databases, and genome databases.[3]

A common approach for learning similarity, is to model the similarity function as a bilinear form. For example, in the case of ranking similarity learning, one aims to learn a matrix W that parametrizes the similarity function .

Metric learning[edit]

Similarity learning is closely related to distance metric learning. Metric learning is the task of learning a distance function over objects. A metric or distance function has to obey four axioms: non-negativity, Identity of indiscernibles, symmetry and subadditivity / triangle inequality. In practice, metric learning algorithms ignore the condition of identity of indiscernibles and learn a pseudo-metric.

When the objects are vectors in , then any matrix in the symmetric positive semi-definite cone defines a distance pseudo-metric of the space of x through the form . When is a symmetric positive definite matrix, is a metric. Moreover, as any symmetric positive semi-definite matrix can be decomposed as where and , the distance function can be rewritten equivalently . The distance corresponds to the Euclidean distance between the projected feature vectors and . Some well-known approaches for metric learning include Large margin nearest neighbor,[4] Information theoretic metric learning (ITML).[5]

In statistics, the covariance matrix of the data is sometimes used to define a distance metric called Mahalanobis distance.


Similarity learning is used in information retrieval for learning to rank, in face verification or face identification,[6][7] and in recommendation systems. Also, many machine learning approaches rely on some metric. This includes unsupervised learning such as clustering, which groups together close or similar objects. It also includes supervised approaches like K-nearest neighbor algorithm which rely on labels of nearby objects to decide on the label of a new object. Metric learning has been proposed as a preprocessing step for many of these approaches .[8]


Metric and similarity learning naively scale quadratically with the dimension of the input space, as can easily see when the learned metric has a bilinear form . Scaling to higher dimensions can be achieved by enforcing a sparseness structure over the matrix model, as done with HDSL,[9] and with COMET.[10]

See also[edit]

Further reading[edit]

For further information on this topic, see the surveys on metric and similarity learning by Bellet et al.[11] and Kulis.[12]


  1. ^ Chechik, G.; Sharma, V.; Shalit, U.; Bengio, S. (2010). "Large Scale Online Learning of Image Similarity Through Ranking" (PDF). Journal of Machine Learning research. 11: 1109–1135. 
  2. ^ Gionis, Aristides, Piotr Indyk, and Rajeev Motwani. "Similarity search in high dimensions via hashing." VLDB. Vol. 99. No. 6. 1999.
  3. ^ Rajaraman, A.; Ullman, J. (2010). "Mining of Massive Datasets, Ch. 3". 
  4. ^ Weinberger, K. Q.; Blitzer, J. C.; Saul, L. K. (2006). "Distance Metric Learning for Large Margin Nearest Neighbor Classification" (PDF). Advances in Neural Information Processing Systems. 18: 1473–1480. 
  5. ^ Davis, J. V.; Kulis, B.; Jain, P.; Sra, S.; Dhillon, I. S. (2007). "Information-theoretic metric learning". International conference in machine learning (ICML): 209–216. 
  6. ^ Guillaumin, M.; Verbeek, J.; Schmid, C. (2009). "Is that you? Metric learning approaches for face identification" (PDF). IEEE International Conference on Computer Vision (ICCV). 
  7. ^ Mignon, A.; Jurie, F. (2012). "PCCA: A new approach for distance learning from sparse pairwise constraints" (PDF). IEEE Conference on Computer Vision and Pattern Recognition (CVPR). 
  8. ^ Xing, E. P.; Ng, A. Y.; Jordan, M. I.; Russell, S. (2002). "Distance Metric Learning, with Application to Clustering with Side-information". Advances in Neural Information Processing Systems. MIT Press. 15: 505–512. 
  9. ^ Liu; Bellet; Sha (2015). "Similarity Learning for High-Dimensional Sparse Data" (PDF). International Conference on Artificial Intelligence and Statistics (AISTATS). 
  10. ^ Atzmon; Shalit; Chechik (2015). "Learning Sparse Metrics, One Feature at a Time" (PDF). J. Mach. Learn. Research (JMLR). 
  11. ^ Bellet, A.; Habrard, A.; Sebban, M. (2013). "A Survey on Metric Learning for Feature Vectors and Structured Data". arXiv:1306.6709Freely accessible [cs.LG]. 
  12. ^ Kulis, B. (2012). "Metric Learning: A Survey" (PDF). Foundations and Trends in Machine Learning.