AI Terminology
/Advanced
Cosine Similarity
Definition
The most common mathematical metric used to measure how similar two vectors are. It measures the cosine of the angle between two multi-dimensional vectors.
Explain Like I'm New
Imagine two arrows shooting out from the center of a graph. If the arrows point in the exact same direction, they are identical concepts (Score = 1). If they form a 90-degree angle, they are completely unrelated (Score = 0). If they point in exact opposite directions, they are exact opposites (Score = -1).
Real World Example
In a Vector Database, when you ask a question, the database calculates the Cosine Similarity between your Question Vector and every Document Vector. It sorts the list, and the document with a score closest to 1.0 is returned as the best answer.
Common Use Cases
- •Vector comparisons
- •Similarity scoring
Interview Questions
basic
- If two vectors have a Cosine Similarity score of 0.99, are they highly similar or highly different?
intermediate
- Why is Cosine Similarity generally preferred over 'Euclidean Distance' for text embeddings?