I have the following metric:
def d(x, y):
"""The metric."""
return 1 - sum(min(xi, yi) for xi, yi in zip(x, y))
where x
and y
are numpy arrays of equal length (~3000). I know that the elements of x and the elements of y each sum up to 1 and are non-negative.
Can this be calculated faster?