1.欧式距离

https://upload-images.jianshu.io/upload_images/14619338-ac03959970569d16.png?imageMogr2/auto-orient/strip|imageView2/2/w/1240

2.曼哈顿距离

https://upload-images.jianshu.io/upload_images/14619338-bb0916498ee5f3bf.png?imageMogr2/auto-orient/strip|imageView2/2/w/1240

两个n维向量a(x11,x12,…,x1n)与 b(x21,x22,…,x2n)间的曼哈顿距离:

https://upload-images.jianshu.io/upload_images/14619338-040c766ad4fe798e.png?imageMogr2/auto-orient/strip|imageView2/2/w/1240

3.切比雪夫距离

https://upload-images.jianshu.io/upload_images/14619338-c8c5a73417a09494.png?imageMogr2/auto-orient/strip|imageView2/2/w/1240

4.闵可夫斯基距离

https://upload-images.jianshu.io/upload_images/14619338-2bb7d1afc40ea4bb.png?imageMogr2/auto-orient/strip|imageView2/2/w/1240

5.标准化欧式距离

https://upload-images.jianshu.io/upload_images/14619338-5514621d8c0a1090.png?imageMogr2/auto-orient/strip|imageView2/2/w/1240

经过简单的推导就可以得到两个n维向量a(x11,x12,…,x1n)与b(x21,x22,…,x2n)间的标准化欧氏距离的公式:

https://upload-images.jianshu.io/upload_images/14619338-09d6ca86a9d8301f.png?imageMogr2/auto-orient/strip|imageView2/2/w/1240

6.马氏距离

https://upload-images.jianshu.io/upload_images/14619338-7e5beebd74b885d3.png?imageMogr2/auto-orient/strip|imageView2/2/w/1240

马氏距离就是用于度量两个坐标点之间的距离关系,表示数据的协方差距离。与欧氏距离不同的是它考虑到各种特性之间的联系(例如:一条关于身高的信息会带来一条关于体重的信息,因为两者是有关联的)并且是尺度无关的(scale-invariant),即独立于测量尺度。 对于一个均值为:

https://upload-images.jianshu.io/upload_images/14619338-c6d27fa5ad5efffb.png?imageMogr2/auto-orient/strip|imageView2/2/w/1240

协方差矩阵为Σ的多变量矢量:

https://upload-images.jianshu.io/upload_images/14619338-1b343c572f8649bd.png?imageMogr2/auto-orient/strip|imageView2/2/w/1240

其马氏距离:

https://upload-images.jianshu.io/upload_images/14619338-796a027c3274f091.png?imageMogr2/auto-orient/strip|imageView2/2/w/1240

如果协方差矩阵为单位矩阵,马氏距离就简化为欧式距离;如果协方差矩阵为对角阵,其也可称为正规化的马氏距离:

https://upload-images.jianshu.io/upload_images/14619338-b3c42eb8fb1ff39f.png?imageMogr2/auto-orient/strip|imageView2/2/w/1240

其中σi是xi的标准差。

7.巴氏距离

https://upload-images.jianshu.io/upload_images/14619338-93bbbbf26f3fe410.png?imageMogr2/auto-orient/strip|imageView2/2/w/1240

对于连续概率分布,Bhattacharyya系数被定义为:

https://upload-images.jianshu.io/upload_images/14619338-85c79fd1b2d6a78a.png?imageMogr2/auto-orient/strip|imageView2/2/w/1240

Bhattacharyya系数是两个统计样本之间的重叠量的近似测量,可以被用于确定被考虑的两个样本的相对接近。

8.汉明距离

汉明距离是使用在数据传输差错控制编码里面的,汉明距离是一个概念,它表示两个(相同长度)字对应位不同的数量,我们以d(x,y)表示两个字x,y之间的汉明距离。对两个字符串进行异或运算,并统计结果为1的个数,那么这个数就是汉明距离。例如: 1011101与1001001之间的汉明距离是2。 2143896与2233796之间的汉明距离是3。 "toned"与"roses"之间的汉明距离是3。

9.夹角余弦

https://upload-images.jianshu.io/upload_images/14619338-f8a0721aa7e79c3f.png?imageMogr2/auto-orient/strip|imageView2/2/w/1240

10.杰卡德相似系数

https://upload-images.jianshu.io/upload_images/14619338-6ef1f6a11308d759.png?imageMogr2/auto-orient/strip|imageView2/2/w/1240

11.皮尔逊系数

https://upload-images.jianshu.io/upload_images/14619338-a5d28841f009f969.png?imageMogr2/auto-orient/strip|imageView2/2/w/1240

https://upload-images.jianshu.io/upload_images/14619338-148abd93aa4a21df.png?imageMogr2/auto-orient/strip|imageView2/2/w/1240

https://upload-images.jianshu.io/upload_images/14619338-84facbc3beb01073.png?imageMogr2/auto-orient/strip|imageView2/2/w/1240

12.DTW距离

https://upload-images.jianshu.io/upload_images/14619338-533a3e4c861339c1.png?imageMogr2/auto-orient/strip|imageView2/2/w/1240

https://upload-images.jianshu.io/upload_images/14619338-d2f5710c9d58b4fe.png?imageMogr2/auto-orient/strip|imageView2/2/w/1240

13.信息熵

https://upload-images.jianshu.io/upload_images/14619338-bd32dab017fa20cb.png?imageMogr2/auto-orient/strip|imageView2/2/w/1240

简单说来,各种"距离"的应用场景简单概括为: 空间:欧氏距离 路径:曼哈顿距离 国际象棋国王:切比雪夫距离 (以上三种的统一形式:闵可夫斯基距离) 加权:标准化欧氏距离 排除量纲和依存:马氏距离 向量差距:夹角余弦 编码差别:汉明距离 集合近似度:杰卡德相似系数与距离 相关:相关系数与相关距离 时间序列:DTW距离