Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is the Wasserstein distance between [0, 1] and [1, 0] zero?

Isn't the Wasserstein distance supposed to be a non-zero number since the probabilities are not equivalent?

In [1]: scipy.stats.wasserstein_distance([0, 1], [1, 0])
Out[1]: 0.0
like image 991
Hyrial Avatar asked Nov 18 '25 03:11

Hyrial


1 Answers

It is because

scipy.stats.wasserstein_distance

expects 1D distributions in the first and second argument. It doesn't matter in which order you obtained the (same) observations, the distribution is the same. Check that for instance

scipy.stats.wasserstein_distance([3, 1, 2, 4, 5], [1 ,4 ,5 ,3 ,2])

is also

0.0

for the same reason.

like image 61
zfabian Avatar answered Nov 19 '25 16:11

zfabian



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!