Why do vectors sometimes "agree" with each other?
Image: NASA/Scott Kelly, Public domain, via Wikimedia Commons
Why do vectors sometimes "agree" with each other?
Imagine you're looking at two arrows on a board, pointing at each other. You want to know how well they align, not just if they're pointing in the same direction.
Think of the arrows as friends holding hands. The closer they are to each other, the stronger their friendship. The dot product is like measuring how tightly they're holding hands, which depends on how long their arms are and the angle between them.
Example
Arrow A is 5 units long, and Arrow B is 3 units long. They're holding hands at a 60-degree angle. The dot product tells us how "strong" their friendship is.
Remember this
The dot product equals the product of the vectors' lengths and the cosine of the angle between them, showing how aligned they are.
Text adapted from Wikipedia, licensed under CC BY-SA 4.0.
List of algorithms
Cosine similarity measures the angle between vectors, not their magnitude
cosine similarity is preferred over dot product for normalized embeddings
Why do we need a special way to measure similarity in high-dimensional spaces?
cosine similarity works better than Euclidean distance in high dimensions
Cosine similarity measures orientation, not magnitude, making it more robust to irrelevant dimensions in high-dimensional spaces
Cosine similarity
Cosine similarity formula: cos(θ) = (A · B) / (||A|| ||B||)
the trace equals the sum of eigenvalues: tr(A) = Σλ_i
How can a vector stay the same after a transformation?
Adam has bias correction: divides by (1-β^t) in early steps
Why do we sometimes need to fix mistakes in computer decisions?
Swipe through 100 ML concepts daily
Open Pocket Polymath