李坏_品职助教 · 2023年08月01日
嗨,从没放弃的小努力你好:
欧氏距离和曼哈顿距离计算如下:
A银行的standardized data分别是:customer_A=-0.456,Loan_book_A=-0.666, branches_A=-0.498,
B银行的standardized data分别是:customer_B=1.147, loan_book_B=1.150, branches_B=1.151.
所以A和B的standardized data的欧式距离=根号下[(-0.456-1.147)^2 + (-0.666-1.15)^2 + (-0.498-1.151)^2] = 根号下8.587=2.931.
所以A和B的standardized data的曼哈顿距离=|-0.456-1.147| + |-0.666-1.15| + |-0.498-1.151|=5.068.
A的normalized data分别是:customerA=0.127, loan_bookA=0, branchesA=0.086,
B的normalized data分别是:customerB=1, loan_bookB=1, branchesB=1,
所以A和B的normalized data的欧氏距离=根号下[(0.127-1)^2+(0-1)^2+(0.086-1)^2] = 1.612.
所以A和B的normalized data的曼哈顿距离=|0.127-1| + |0-1| + |0.086-1| =2.787.
----------------------------------------------就算太阳没有迎着我们而来,我们正在朝着它而去,加油!