Measuring similarity
"Close means similar" needs a ruler. There are three in common use (cosine similarity, dot product and distance), and on most modern embeddings they agree. Knowing when they don't saves you from a search that ranks the same few documents first for no good reason.
In this lesson you'll learn to
- Explain cosine similarity as the angle between two vectors, and read its scores.
- Compute a dot product and explain how a vector's length changes it.
- Explain Euclidean distance and why ranking by it matches cosine on normalised vectors.
- Pick the metric your embedding model expects, and normalise vectors when the docs say to.
Create a free account to open this lesson
It's free. You'll get every free lesson, quizzes that save your progress, daily flashcards and streaks.