I have a few points in multiple dimensions. I am able to compute similarity between those items (using, say Cosine distance). For example,

       dim1 dim2 dim3
point1  100    1    0
point2   50    1    0
point3  100    0    1
point4   20    0    1
point5   50    0    1
point6  100    0    1
point7   20    0    1

          point1    point2    point3    point4    point5    point6
point2 0.9999500                                                  
point3 0.9999000 0.9997501                                        
point4 0.9987024 0.9985526 0.9992018                              
point5 0.9997501 0.9996002 0.9999500 0.9995512                    
point6 0.9999000 0.9997501 1.0000000 0.9992018 0.9999500          
point7 0.9987024 0.9985526 0.9992018 1.0000000 0.9995512 0.9992018

Now I want to find items dissimilar to multiple points. For example, I know from above that point1 and point7 are very dissimilar. If I want to find the point most dissimilar to both of them, my intuition is point4 is the most dissimilar to both.

I tried adding up the similarity scores but it doesn't give me exactly what I want.

What is the mathematically sound way to compute distance from multiple points?

  • 1
    $\begingroup$ It might be worth noticing that the relatively large values in the first dimension dominate the cosine similarity scores. This implies that the points most dissimilar to both point1 (first component is 100) and point7 (first component is 20) necessarily will have first components as close as possible to (100+20)/2 = 60. The best candidates are point2 and point5 but definitely not point4 (which coincides with point7!). This naturally raises the prior question (which ought to be settled before we go on), what is your similarity measure trying to represent? $\endgroup$ – whuber Jun 3 '14 at 22:39
  • $\begingroup$ Thanks whuber, I am trying to pick products that are dissimilar. So ideally not in the same category (dim2 and dim3 are coded categories) and if the same category, then different price points (dim1). The above seems to do that. e.g point2 is more similar to point1 because dim2 and dim3 are equivalent, even though by dim1 it is closest to point5. But I am not married to the measure, would Euclidean distance be more appropriate for this? $\endgroup$ – ignorant Jun 4 '14 at 15:46
  • $\begingroup$ ok, got some insight. The above works using Euclidean distance or scaled Cosine distance. In R code,library(proxy); prods2.mat <- as.matrix(dist(prods2, method = "Euclidean")); colnames(prods2.mat)[order(prods2.mat["point1",] + prods2.mat["point4", ], decreasing=TRUE)]; prods2.mat <- as.matrix(dist(scale(prods2), method = "Cosine")); colnames(prods2.mat)[order(prods2.mat["point1",] + prods2.mat["point4", ], decreasing=TRUE)]; I am not sure if this is a happy coincidence or correct. $\endgroup$ – ignorant Jun 4 '14 at 18:18
  • $\begingroup$ So using Euclidean distance, adding them up makes sense. For two points it is like drawing an ellipse around them. It worked for me in practice. $\endgroup$ – ignorant Jun 5 '14 at 20:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.