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

前端 未结 8 1727
悲&欢浪女
悲&欢浪女 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:23

    Yes, there is a most general way to change between similarity and distance: a strictly monotone decreasing function f(x).

    That is, with f(x) you can make similarity = f(distance) or distance = f(similarity). It works in both directions. Such function works, because the relation between similarity and distance is that one decreases when the other increases.

    Examples:

    These are some well-known strictly monotone decreasing candidates that work for non-negative similarities or distances:

    • f(x) = 1 / (a + x)
    • f(x) = exp(- x^a)
    • f(x) = arccot(ax)

    You can choose parameter a>0 (e.g., a=1)

提交回复
热议问题