I've computed the cosine similarity between a
& b
(=x
) and b
& c
(=y
). I can use the same embeddings to compute the similarity between a
and c
(assuming it's = z
).
I've a situation wherein I've only the similarity measures x
and y
. How can I find the similarity between a
& c
, without the original embeddings? If I use a plane to represent this then I will have infinite number of solutions. Are there any approaches which provides some insights about the relation between a
and c
?
a = torch.Tensor([1, 2])
b = torch.Tensor([1, -1])
c = torch.Tensor([2, 3])
sim_ab = torch.dot(a, b) / (torch.sqrt(sum(torch.square(a)) * sum(torch.square(b))))
sim_ac = torch.dot(a, c) / (torch.sqrt(sum(torch.square(a)) * sum(torch.square(c))))
sim_bc = torch.dot(b, c) / (torch.sqrt(sum(torch.square(b)) * sum(torch.square(c))))
print("Actual similarity between b and c: ", sim_bc)
x = torch.arccos(sim_ab)
y = torch.arccos(sim_ac)
print("Measured similarity between b and c: ", torch.cos(x-y))
>>> Actual similarity between b and c: tensor(-0.1961)
>>> Measured similarity between b and c: tensor(-0.1961)