Calculate distance between two vectors of different length

前端 未结 4 804
面向向阳花
面向向阳花 2020-12-16 15:16

There are different methods to calculate distance between two vectors of the same length: Euclidean, Manhattan, Hamming ...

I\'m wondering about any method that woul

4条回答
  •  死守一世寂寞
    2020-12-16 15:35

    You cannot directly compute distances between vectors of differing length.

    All suggestions here start with a function that maps the lower-length vector to a higher-length one, then doing the calculation as normal.

    There are many, many functions (infinitely many, in fact) that one can use:

    • Fill up with zeroes. It's the easiest thing to do. Say, if you have a car and need to compute its distance to an airplane, this places the car at sea level.
    • Look up the missing values somewhere. With the car-airplane example, you'd fire up your geo database and look up heights from longitude/latitude.
    • Use some mathematical function.

    Since the result of the distance calculation strongly depends on the function that converts the shorter vector to the longer, everybody needs to be clear about what function is used. Either because everybody in the fields agrees that only one function makes sense, or because the function used in the conversion is noted down.

提交回复
热议问题