Closed juskuz closed 1 year ago
euc_sim()
computes negative squared euclidean distance. it's negative because we need the largest value to indicate most similar (closest) pair of vectors, and we're not taking sqrt of it because what matters is the order of the values, not the values themselves, so we might as well save some computation by not doing sqrt
Thanks for clarification. I wanted to use the euc_sim formula for another computations (or write unit tests for myself) and the value of distance was a bit unclear.
I tested the method
euc_sim()
and it seems that values are not squared. Example:Could anyone explain why? I suppose that sqrt doesn't change the order when looking for max value (max similarity). I compared it with
torch.cdist()
and there are squered values. Example (same variables a and b):