Similarity Measures: Cosine, Dot Product, and Manhattan Distance

Explore the use of various distance metrics, including cosine similarity, dot product, and Manhattan distance to measure similarity search in vector databases.

Similarity search is a fundamental operation in vector databases, where the goal is to find data points (vectors) that are similar to a given query vector. To measure this similarity, various distance metrics are employed.

Cosine similarity

Cosine similarity is a widely used metric in similarity search within vector databases, especially for applications involving high-dimensional, sparse data such as text documents, user preferences, or image features. It measures the cosine of the angle between two vectors, providing an indication of how similar they are in terms of direction, regardless of their magnitude.

Get hands-on with 1200+ tech skills courses.