How do I convert between a measure of similarity and a measure of difference (distance)?

前端 未结 8 1714
悲&欢浪女
悲&欢浪女 2021-02-02 01:57

Is there a general way to convert between a measure of similarity and a measure of distance?

Consider a similarity measure like the number of 2-grams that two strings ha

8条回答
  •  孤独总比滥情好
    2021-02-02 02:25

    In one of my projects (based on Collaborative Filtering) I had to convert between correlation (cosine between vectors) which was from -1 to 1 (closer 1 is more similar, closer to -1 is more diverse) to normalized distance (close to 0 the distance is smaller and if it's close to 1 the distance is bigger)

    In this case: distance ~ diversity

    My formula was: dist = 1 - (cor + 1)/2

    If you have similarity to diversity and the domain is [0,1] in both cases the simlest way is:

    dist = 1 - sim

    sim = 1 - dist

提交回复
热议问题