Euclidean distance with numpy

import numpy as np from math import sqrt x = np.array([2,3,1,0]) y = np.array([2,3,1,0]) def findEuclideanDistance(source_representation, test_representation): calculate = sum([(a - b) ** 2 for a, b in zip(source_representation, test_representation)]) euclideanResult = sqrt(calculate) return euclideanResult result = findEuclideanDistance(x, y) print (result)
Euclidean distance with numpy

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.