diff --git a/learning.py b/learning.py index df5d6fce3..f84017a87 100644 --- a/learning.py +++ b/learning.py @@ -35,6 +35,9 @@ def manhattan_distance(predictions, targets): def mean_boolean_error(predictions, targets): return mean(int(p != t) for p, t in zip(predictions, targets)) +def hamming_distance(predictions, targets): + return sum(p != t for p, t in zip(predictions, targets)) + # ______________________________________________________________________________