当前位置:首页 » 《随便一记》 » 正文

机器学习中的数学——距离定义(一):欧几里得距离(Euclidean Distance)

24 人参与  2022年11月29日 09:29  分类 : 《随便一记》  评论

点击全文阅读


分类目录:《机器学习中的数学》总目录
相关文章:
· 距离定义:基础知识
· 距离定义(一):欧几里得距离(Euclidean Distance)
· 距离定义(二):曼哈顿距离(Manhattan Distance)
· 距离定义(三):闵可夫斯基距离(Minkowski Distance)
· 距离定义(四):切比雪夫距离(Chebyshev Distance)
· 距离定义(五):标准化的欧几里得距离(Standardized Euclidean Distance)
· 距离定义(六):马氏距离(Mahalanobis Distance)
· 距离定义(七):兰氏距离(Lance and Williams Distance)/堪培拉距离(Canberra Distance)
· 距离定义(八):余弦距离(Cosine Distance)
· 距离定义(九):测地距离(Geodesic Distance)
· 距离定义(十): 布雷柯蒂斯距离(Bray Curtis Distance)
· 距离定义(十一):汉明距离(Hamming Distance)
· 距离定义(十二):编辑距离(Edit Distance,Levenshtein Distance)
· 距离定义(十三):杰卡德距离(Jaccard Distance)和杰卡德相似系数(Jaccard Similarity Coefficient)
· 距离定义(十四):Ochiia系数(Ochiia Coefficient)
· 距离定义(十五):Dice系数(Dice Coefficient)
· 距离定义(十六):豪斯多夫距离(Hausdorff Distance)
· 距离定义(十七):皮尔逊相关系数(Pearson Correlation)
· 距离定义(十八):卡方距离(Chi-square Measure)
· 距离定义(十九):交叉熵(Cross Entropy)
· 距离定义(二十):相对熵(Relative Entropy)/KL散度(Kullback-Leibler Divergence)
· 距离定义(二十一):JS散度(Jensen–Shannon Divergence)
· 距离定义(二十二):海林格距离(Hellinger Distance)
· 距离定义(二十三):α-散度(α-Divergence)
· 距离定义(二十四):F-散度(F-Divergence)
· 距离定义(二十五):布雷格曼散度(Bregman Divergence)
· 距离定义(二十六):Wasserstein距离(Wasserstei Distance)/EM距离(Earth-Mover Distance)
· 距离定义(二十七):巴氏距离(Bhattacharyya Distance)
· 距离定义(二十八):最大均值差异(Maximum Mean Discrepancy, MMD)
· 距离定义(二十九):点间互信息(Pointwise Mutual Information, PMI)


欧几里得距离或欧几里得度量是欧几里得空间中两点间的即直线距离。使用这个距离,欧氏空间成为度量空间,相关联的范数称为欧几里得范数。

n n n维空间中的欧几里得距离:
d ( x , y ) = ∑ i = 1 n ( x i − y i ) 2 = ( x 1 − y 1 ) 2 + ( x 2 − y 2 ) 2 + ⋯ + ( x n − y n ) 2 d(x, y)=\sqrt{\sum_{i=1}^n(x_i-y_i)^2}=\sqrt{(x_1-y_1)^2+(x_2-y_2)^2+\cdots+(x_n-y_n)^2} d(x,y)=i=1∑n​(xi​−yi​)2 ​=(x1​−y1​)2+(x2​−y2​)2+⋯+(xn​−yn​)2 ​

2 2 2维空间中的欧几里得距离:
d ( x , y ) = ( x 1 − y 1 ) 2 + ( x 2 − y 2 ) 2 d(x, y)=\sqrt{(x_1-y_1)^2+(x_2-y_2)^2} d(x,y)=(x1​−y1​)2+(x2​−y2​)2 ​

下面我们来看一下欧几里得距离的Python实现:

def EuclideanDistance(x, y):    import numpy as np    x = np.array(x)    y = np.array(y)    return np.sqrt(np.sum(np.square(x-y)))

点击全文阅读


本文链接:http://zhangshiyu.com/post/49238.html

<< 上一篇 下一篇 >>

  • 评论(0)
  • 赞助本站

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

关于我们 | 我要投稿 | 免责申明

Copyright © 2020-2022 ZhangShiYu.com Rights Reserved.豫ICP备2022013469号-1