I've been trying to familiarize myself with the Wasserstein distance and saw this answer on StackExchange by @antike that at first made a lot of sense, but then it didn't (to me, of course).
In the chart, you can see distributions where one group accounts for 60% of items (leftmost bar), and 4 more groups account for 10% each. Then the idea is that if you want to move the 60% bar to one spot to the right, the cost is 0.5, and if you want to move it 4 spots to the right the cost is 0.5*4=2.
That makes a lot of sense and easy to intuitively understand. But then things got complicated.
from scipy.stats import wasserstein_distance and calculate the distance between a vector like
[6,1,1,1,1] and any permutation of it where the
6 "moves around", you would get (1) the same Wasserstein Distance, and (2) that would be 0.
I don't understand why either (1) and (2) occur, and would love your help understanding. If I have 10 pebbles in piles lined on a row, 6 stacked in the first position 4 more piles of 1 pebble, and I wanted to make the second pile have 6 pebbles instead of the first one, then I would need to do an amount of work which is 5 - which is 5 times moving 1 pebble one position.
Appreciate your help!
Edit: some code:
from scipy.stats import wasserstein_distance import numpy as np a = np.array([6,1,1,1,1]) b = np.array([1,6,1,1,1]) c = np.array([1,1,6,1,1]) print(wasserstein_distance(a,b)) print(wasserstein_distance(a,c)) print(wasserstein_distance(b,c)) print(wasserstein_distance(a/10,b/10)) print(wasserstein_distance(b/10,c/10)) print(wasserstein_distance(a*10,b*10)) print(wasserstein_distance(a*10,b*10)) print(wasserstein_distance([6,1,1,1,1],[1,1,1,1,6]))
all of these print
Would love to be shown I was making a foolish mistake.