2
$\begingroup$

I have the following problem.

I have 3 vectors $u,v,w$ of n dimensions. I'm able to find cosine similarities between $u$ and $v$, and between $v$ and $w$: $cosine(u,v)$ and $cosine(v,w)$.

Can i use these cosine similarities to compute the cosine similarity between $u$ and $v$ $cosine(u,w)$?

Thanks

$\endgroup$
1
  • $\begingroup$ This is like with correlation coefficient. In general case - no, you cannot point-estimate (compute precise value) of cosine(u,w), knowing only the other two cosines. Cosine or correlation can be imagined as the angle between a pair of vectors starting from the same origin. So you have 3 vectors and you know two angles of the three. Because in general case 3 vectors lie in 3D space, the 3rd angle can vary though the other two are fixed (known). $\endgroup$
    – ttnphns
    Commented Apr 5, 2023 at 12:00

1 Answer 1

1
$\begingroup$

As said by @ttnphns in the comment, you cannot use the two to calculate the third similarity. What you can do though is to use them to find bounds for it. One such "triangle inequality" is described in the Wikipedia article and more by Shubert (2021) in the "A Triangle Inequality for Cosine Similarity" paper that discusses many other such bounds and their properties.

$\endgroup$
2
  • 1
    $\begingroup$ Speaking of the computation of the bounds, I might suggest the OP to visit also this thread stats.stackexchange.com/q/254282/3277 . It is about correlation. $\endgroup$
    – ttnphns
    Commented Apr 5, 2023 at 12:18
  • $\begingroup$ Thanks a lot for your fast and relevant answers! $\endgroup$
    – Chg
    Commented Apr 5, 2023 at 19:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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