0


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

分类目录:《机器学习中的数学》总目录
相关文章:
· 距离定义:基础知识
· 距离定义(一):欧几里得距离(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)


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

  1. n
  2. n
  3. n维空间中的欧几里得距离:
  4. d
  5. (
  6. x
  7. ,
  8. y
  9. )
  10. =
  11. i
  12. =
  13. 1
  14. n
  15. (
  16. x
  17. i
  18. y
  19. i
  20. )
  21. 2
  22. =
  23. (
  24. x
  25. 1
  26. y
  27. 1
  28. )
  29. 2
  30. +
  31. (
  32. x
  33. 2
  34. y
  35. 2
  36. )
  37. 2
  38. +
  39. +
  40. (
  41. x
  42. n
  43. y
  44. n
  45. )
  46. 2
  47. 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}
  48. d(x,y)=i=1n​(xi​−yi​)2​=(x1​−y1​)2+(x2​−y2​)2+⋯+(xn​−yn​)2
  49. 2
  50. 2
  51. 2维空间中的欧几里得距离:
  52. d
  53. (
  54. x
  55. ,
  56. y
  57. )
  58. =
  59. (
  60. x
  61. 1
  62. y
  63. 1
  64. )
  65. 2
  66. +
  67. (
  68. x
  69. 2
  70. y
  71. 2
  72. )
  73. 2
  74. d(x, y)=\sqrt{(x_1-y_1)^2+(x_2-y_2)^2}
  75. d(x,y)=(x1​−y1​)2+(x2​−y2​)2

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

  1. defEuclideanDistance(x, y):import numpy as np
  2. x = np.array(x)
  3. y = np.array(y)return np.sqrt(np.sum(np.square(x-y)))

本文转载自: https://blog.csdn.net/hy592070616/article/details/121461909
版权归原作者 von Neumann 所有, 如有侵权,请联系我们删除。

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

还没有评论