ErrorMitigation / src /utils /metrics.py
Dvirmor100's picture
style: using black and ruff to format the project
e0d7f28
Raw History Blame Contribute Delete
475 Bytes
import math
def euclidean_distance(list1, list2):
"""
Computes the Euclidean distance between two lists of numbers.
:param list1: The first list of numbers.
:param list2: The second list of numbers.
:return: The Euclidean distance as a float.
"""
if len(list1) != len(list2):
raise ValueError("Both lists must be of the same length")
squared_diff = sum((a - b) ** 2 for a, b in zip(list1, list2))
return math.sqrt(squared_diff)