Professional Documents
Culture Documents
Dist
Dist
Euclidean Distance
• Euclidean Distance
n
dist ( pk qk ) 2
k 1
p1
point x y
2
p1 0 2
p3 p4
1
p2 2 0
p2 p3 3 1
0 p4 5 1
0 1 2 3 4 5 6
Distance
p1 p2 p3 p4 Between P1
p1 0 2.828 3.162 5.099 and P2 is
p2 2.828 0 1.414 3.162 Sqrt[(0-2)2 +
p3 3.162 1.414 0 2 (2-0)2]
p4 5.099 3.162 2 0 =Sqrt(8) =
2.828
Distance Matrix
Minkowski Distance
Object B 7 6 3 -1
• r = 2. Euclidean distance
1 n
j ,k ( X ij X j )( X ik X k )
n 1 i 1
When the covariance matrix is identity
Matrix, the mahalanobis distance is the
same as the Euclidean distance.
A
P Useful for detecting outliers.
p= 1000000000
q= 0000001001
• Example:
d1 = 3 2 0 5 0 0 0 2 0 0
d2 = 1 0 0 0 0 0 0 1 0 2
d1 d2= 3*1 + 2*0 + 0*0 + 5*0 + 0*0 + 0*0 + 0*0 + 2*1 + 0*0 + 0*2 = 5
||d1|| = (3*3+2*2+0*0+5*5+0*0+0*0+0*0+2*2+0*0+0*0)0.5 = (42) 0.5 =
6.481
||d2|| = (1*1+0*0+0*0+0*0+0*0+0*0+0*0+1*1+0*0+2*2) 0.5 = (6) 0.5 = 2.245