Is cosine similarity the only way to measure similarity?
In most word embedding models like w2v or Glove or … we use cosine similarity when we want to see the performance of the model. However, suppose that we have two vectors in the same direction but with different sizes, regarding cosine similarity they are similar but with another one like Euclidian they are different. (Like these vectors: [10,0] , [1,0])What is the best way to measure the performance of and embedding model?Thanks
2022-07-28T00:33:34Z
depends on what property you are interested ina nice property of cosine similarity is its scale invariance, as the example you give demonstratesScreenshot_20220728-023129_Chrome1746×1746 197 KBen.m.wikipedia.orgCosine similarityIn data analysis, cosine similarity is a measure of similarity between two sequences of numbers. For defining it, the sequences are viewed as vectors in an inner product space, and the cosine similarity is defined as the cosine of the angle between them, that is, the dot product of the vectors divided by the product of their lengths. It follows that the cosine similarity does not depend on the magnitudes of the vectors, but only on their angle. The cosine similarity always belongs to the interval...
2022-07-28T05:49:46Z
Yes, that is true. So, how can I make sure in feature space, two words which is not similar to each other, take the vector in same direction but with different size like [1,0], [10,0]. Because they may place anywhere in space.
2022-08-01T09:37:31Z
https://docs.scipy.org/doc/scipy/reference/generated/scipy.spatial.distance.cdist.htmmany of the more than 20 different distance measures defined in scipy can probably be easily converted to similarity measures. For 6 (Y = cdist(XA, XB, ‘cosine’)) for example, 1 - cdist(XA, XB, ‘cosine’)) is cosine(XA, XB)?