Spaces:
Runtime error
Runtime error
Download src/utils/metrics.py from QuantumGenAI/ErrorMitigation: direct link, hf CLI and curl.
- Browser
- Download file 475 Bytes
-
https://huggingface.co/spaces/QuantumGenAI/ErrorMitigation/resolve/main/src/utils/metrics.py
- Command line
-
hf download hf://spaces/QuantumGenAI/ErrorMitigation/src/utils/metrics.py
-
curl -L -o metrics.py https://huggingface.co/spaces/QuantumGenAI/ErrorMitigation/resolve/main/src/utils/metrics.py
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) | |