0
$\begingroup$

In a vector space model when we are given a query as a vector π‘žβƒ— and documents 𝑑1 , 𝑑2 …, we usually rank the documents in relevance to the query vector using cosine similarity. Show by a mathematical proof that if the vectors π‘žβƒ— and 𝑑𝑖 all are normalized unit vectors (i.e., |π‘₯βƒ—|) than the ranking by ordering the documents with increasing euclidean distance from the query is always identical to the ranking of ordering the documents with decreasing cosine similarity.

$\endgroup$
1
  • $\begingroup$ Is this not a (self-)study question? $\endgroup$ Commented Dec 31, 2020 at 22:58

1 Answer 1

5
$\begingroup$

Just notice that, if $u$ and $v$ are unit vectors, then $$ \Vert u-v\Vert^2=\Vert u\Vert^2+\Vert v\Vert^2-2 \langle u,v\rangle=2(1- \cos \theta), $$ where $\theta$ is the angle between $u$ and $v$. Therefore, in this case, ordering by Euclidean distance is the same as ordering by cosine dissimilarity.

$\endgroup$
3
  • $\begingroup$ thank you for your answer, but are you sure that a right answer ? $\endgroup$ Commented Dec 12, 2020 at 17:35
  • $\begingroup$ I don't care about the typo I just need the right answer $\endgroup$ Commented Dec 12, 2020 at 17:55
  • $\begingroup$ thank you sir I thankful your help $\endgroup$ Commented Dec 12, 2020 at 18:01

Not the answer you're looking for? Browse other questions tagged or ask your own question.