Euclidean Distance
Euclidean distance (L2 distance) is the straight-line distance between two vectors in n-dimensional space, computed as the square root of the sum of squared differences.
What is Euclidean Distance?
Euclidean distance (L2 distance) is the straight-line distance between two vectors in n-dimensional space, computed as the square root of the sum of squared differences.
Euclidean distance (L2 distance) is the straight-line distance between two vectors in n-dimensional space, computed as the square root of the sum of squared differences.
Where is it used?
FAISS `IndexFlatL2` and `sklearn.neighbors.NearestNeighbors(metric='euclidean')` use L2; some image embedding models (CLIP variants) are trained with L2-based contrastive loss.
How to build it
Use `torch.cdist(a.unsqueeze(0), b.unsqueeze(0))` or `np.linalg.norm(a-b)`; in FAISS, `IndexFlatL2` returns squared L2 distances, so compare without sqrt for ranking.