Skip to main content
fix notation and equation
Source Link
qwr
  • 151
  • 1
  • 6

Caveat: for normalized vectors (unit vectors), cosine similarity and Euclidean distance are essentially equivalent (minimizing, as minimizing one is equivalent to maximizing the other). This is because for unit vectors, cosine similarity is computed simply as a dot product, and $\lVert x - y\rVert^2 = 2 - x^T y$$\lVert \mathbf x - \mathbf y\rVert^2 = (\mathbf x - \mathbf y) \cdot (\mathbf x - \mathbf y) = 2 - 2 (\mathbf x \cdot \mathbf y)$. Computationally, athe dot product is faster because it can be used on sparse vectors and saves on one vector subtractionsimpler.

Caveat: for normalized vectors (unit vectors), cosine similarity and Euclidean distance are essentially equivalent (minimizing one is equivalent to maximizing the other). This is because for unit vectors, cosine similarity is computed simply as a dot product and $\lVert x - y\rVert^2 = 2 - x^T y$. Computationally, a dot product is faster because it can be used on sparse vectors and saves on one vector subtraction.

Caveat: for normalized vectors (unit vectors), cosine similarity and Euclidean distance are essentially equivalent, as minimizing one is equivalent to maximizing the other. This is because for unit vectors, cosine similarity is computed simply as a dot product, and $\lVert \mathbf x - \mathbf y\rVert^2 = (\mathbf x - \mathbf y) \cdot (\mathbf x - \mathbf y) = 2 - 2 (\mathbf x \cdot \mathbf y)$. Computationally, the dot product is simpler.

Source Link
qwr
  • 151
  • 1
  • 6

Caveat: for normalized vectors (unit vectors), cosine similarity and Euclidean distance are essentially equivalent (minimizing one is equivalent to maximizing the other). This is because for unit vectors, cosine similarity is computed simply as a dot product and $\lVert x - y\rVert^2 = 2 - x^T y$. Computationally, a dot product is faster because it can be used on sparse vectors and saves on one vector subtraction.