分类目录:《机器学习中的数学》总目录
相关文章:
· 距离定义:基础知识
· 距离定义(一):欧几里得距离(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=1n(xiyi)2=(x1y1)2+(x2y2)2++(xnyn)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)=(x1y1)2+(x2y2)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)))
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。