What is a cosine similarity matrix?
Cosine similarity and its applications.
Published in
3 min readJan 28, 2020
Cosine similarity is a metric used to determine how similar two entities are irrespective of their size. Mathematically, it measures the cosine of the angle between two vectors projected in a multi-dimensional space.
When we say two vectors, they could be two product descriptions, two titles of articles or simply two arrays of words.
Mathematically, if ‘a’ and ‘b’ are two vectors, cosine equation gives the angle between the two.
Example:
This will give us the depiction below of different aspects of cosine similarity:
Let us see how we can compute this using Python. We have the following five texts:
#Define Documents
Document_A: Alpine snow winter boots.Document_B: Snow winter jacket.Document C: Active swimming briefs.Document D: Active running shorts.