Cosine Similarity
Implement normalized cosine similarity to evaluate the embedding model.
We'll cover the following...
Chapter Goals:
Learn about cosine similarity and how it's used to compare embedding vectors
Create a function that computes cosine similarities for a given word
A. Vector comparison
In mathematics, the standard way for comparing vector similarity is through cosine similarity. Since word embeddings are just vectors of real numbers, we can use also cosine similarity to compare embeddings for different words.
For two vectors, u and v, the equation for cosine similarity is
where
We refer to the quantity
Ask