Question

I don't understand this picture, which says if we change the coordinate system, we would have the same result for $L_2$ distance, whereas, our result would differ for $L_1$ distance. What does it mean by coordinate system? $(0,0)$ if yes, the assertion is not true.

Stanford_Ldistance

I mean, suppose we have a picture with this matrix A, and another with B, for calculating their L1(Manhattan) and L2(Euclidean) distances, we would have the following code, how is this slide applied to the proposed problem?

import numpy as np
A = [[0,21,2],[3,4,5],[6,7,8]]
B = [[5,6,37],[8,0,10],[11,12,13]]
L1 = np.zeros((3,3))
L2 = np.zeros((3,3))
C = np.zeros((3,3))
for i in range(len(A)):
    for j in range(len(A)):
        L1[i][j] = np.abs(A[i][j] - B[i][j])
        L2[i][j] = np.power((A[i][j] - B[i][j]),2)    
sum(sum(L1)),np.sqrt(sum(sum(L2)))

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with datascience.stackexchange
scroll top