Cosine similarity is a measure used to determine how similar two vectors are, regardless of their size. It calculates the cosine of the angle between the two vectors in a multi-dimensional space. A cosine similarity of 1 indicates that the vectors are identical, while a value of 0 means they are orthogonal, or completely dissimilar.
This metric is commonly used in natural language processing and information retrieval to compare text documents. By representing documents as vectors based on word frequency, cosine similarity helps identify how closely related different texts are, making it useful for tasks like document clustering and recommendation systems.