Cosine Similarity Calculator

Function to calculate the cosine similarity

Calculate the cosine similarity


This function calculates the cosine similarity. Cosine similarity is a measure of how similar two vectors are. The cosine of the angle between the two vectors is determined.

To calculate, enter a series of x /y pairs (vectors). The individual numbers are separated by semicolons or spaces. Then click on the 'Calculate' button.


Cosine Similarity Calculator

 Input
Argument X
Argument Y
Decimal places
  Result

Formula for cosine similarity

\(\displaystyle d_{\mathbf{cos}} : (x, y) \mapsto 1-\frac{\langle x, y\rangle}{\|x\|_2\|y\|_2} \) \(\displaystyle = 1-\frac{\sum_{i=1}^{n} x_i y_i}{\sqrt{\sum_{i=1}^{n} x_i^2}\sqrt{\sum_{i=1}^{n} y_i^2}}\)
Is this page helpful?            
Thank you for your feedback!

Sorry about that

How can we improve it?