« Back to Glossary Index

Cosine similarity is a measure of how similar two vectors are, based on the angle between them. It is calculated by taking the dot product of the two vectors and dividing it by the product of their magnitudes. The result is a value between -1 and 1, where 1 means the vectors are identical, 0 means they are orthogonal (perpendicular), and -1 means they are opposite.

Cosine similarity is often used in natural language processing to compare the meanings of words, sentences, or documents, based on their embeddings. Embeddings are numerical representations of text that capture its semantic and syntactic features.

Graphical representation of “Cosine Similarity”:

« Back to Glossary Index