if you want to calculate the distance between 4 features coordinates, you do it like that :

A (1,2,5,1)

B (7, 1, 3, 0)

import math dist = math.sqrt((7-1)**2+(1-2)**2+(3-5)**2+(0-1)**2) print(dist) >>> 6.4807 ...

Skip to content
data science machine learning
# calculating distance for four features

Always cooking something nice!

if you want to calculate the distance between 4 features coordinates, you do it like that :

A (1,2,5,1)

B (7, 1, 3, 0)

import math dist = math.sqrt((7-1)**2+(1-2)**2+(3-5)**2+(0-1)**2) print(dist) >>> 6.4807 ...