3 ms·
It's not even a distance metric, it doesn't obey the triangle inequality (hence the not-technically-meaningful name "similarity", like "collection" as opposed t
by nerdponx 3y ago
It's not even a distance metric, it doesn't obey the triangle inequality (hence the not-technically-meaningful name "similarity", like "collection" as opposed to "set").
- deleted 3y ago[deleted]
- Der_Einzige 3y agoNot obeying the triangle inequality simply means that it’s fast to compute.
- queuebert 3y agoOne does not normally consider trigonometric functions fast to compute. Would you mind elaborating?
- SR2Z 3y agoYou don't need to call cosine to compute cosine similarity - most of the time, a normalized dot product is sufficient. Needless to say, dot products are directly supported in hardware via the FMA unit.
- seanhunter 3y agoConsider the geometric definition of the dot product of two vectors, a.b = |a||b|cos theta. This means you get cos of the angle between the two vectors by just dividing the dot product by the product of their magnitudes. You don't actually take cos of the angle to get cosine similarity (for one because you don't know the angle) you just use "cos theta" (calculated as above) as a proxy for how narrow the angle is and therefore how close the two embeddings are. The paper in TFA shows that if you construct an embedding space such that that angle isn't meaningfully measuring similarity then a low angle doesn't mean two things are very similar. I have a similar paper measuring bears and woods but I haven't got around to typesetting it for publication yet.
- __tmk__ 3y ago1-cos_sim(x,y) is a valid distance metric for L2 normalized vectors, though.
- epgui 3y agoIt is a distance metric on a projection.