Cosine Similarity

Cosine Similarity is:

  • a measure of similarity between two non-zero vectors of an inner product space

  • the cosine of the trigonometric angle between two vectors

  • the inner product of two vectors normalized to length 1

  • applied to vectors of low and high dimensionality

  • not a measure of vector magnitude, just the angle between vectors

Euclidean Vector Dot Product Cosine Similarity

A Euclidean Vector is a geometric object that has a magnitude and direction.

The definition of a Euclidean Vector Dot Product Cosine Similarity is as follows:

Interpreting Results

The illustration below indicates how to interpret the cosine similarity in terms of the angle of separation between two vectors:

Applications

Applications include:

  • Embedded Values Analysis - such as word embeddings and causal embeddings

  • Image Processing - such as comparing shapes, arrangements, positions

  • Natural Language Processing - such as comparing phrases, documents, queries

An Example

An example is measuring the similarity between documents based on word counts: