← Classical AI, NLP & Linguistics
Cosine Similarity
Cosine similarity measures the angle between two vectors in a high-dimensional space, computed as their dot product divided by the product of their magnitudes. It ranges from -1 to 1, with 1 indicating identical direction regardless of vector length. In NLP, cosine similarity is the standard measure for comparing document representations — TF-IDF vectors, word embeddings, or sentence embeddings — because it is insensitive to document length and captures directional similarity, which corresponds to semantic relatedness in well-trained embedding spaces.