2

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

Chg
  • 21
  • 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). – ttnphns Apr 05 '23 at 12:00

1 Answers1

1

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.

Tim
  • 138,066
  • 1
    Speaking of the computation of the bounds, I might suggest the OP to visit also this thread https://stats.stackexchange.com/q/254282/3277 . It is about correlation. – ttnphns Apr 05 '23 at 12:18
  • Thanks a lot for your fast and relevant answers! – Chg Apr 05 '23 at 19:22