Skip to content

Commit

Permalink
Update cosine-similarity.md
Browse files Browse the repository at this point in the history
  • Loading branch information
dluc authored Jan 4, 2024
1 parent fcb952f commit 957b9f6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions docs/concepts/cosine-similarity.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,20 @@ layout: default

Cosine similarity is a measure of the degree of similarity between two vectors in
a multidimensional space. It is commonly used in artificial intelligence and natural
language processing to compare [embeddings](/concepts/embedding),
language processing to compare [embeddings](embedding),
which are numerical representations of
words or other objects.

The cosine similarity between two vectors is calculated by taking the
[dot product](/concepts/dot-product) of the two vectors and dividing it by the product
[dot product](dot-product) of the two vectors and dividing it by the product
of their magnitudes. This results in a value between -1 and 1, where 1 indicates
that the two vectors are identical, 0 indicates that they are orthogonal
(i.e., have no correlation), and -1 indicates that they are opposite.

Cosine similarity is particularly useful when working with high-dimensional data
such as word embeddings because it takes into account both the magnitude and direction
of each vector. This makes it more robust than other measures like
[Euclidean distance](/concepts/euclidean-distance), which only considers the magnitude.
[Euclidean distance](euclidean-distance), which only considers the magnitude.

One common use case for cosine similarity is to find similar words based on their
embeddings. For example, given an embedding for "cat", we can use cosine similarity
Expand Down

0 comments on commit 957b9f6

Please sign in to comment.