I want to use the Wasserstein distance from scipy.stats.wasserstein_distance to get a measure for the difference between two probability distribution. However, I do not understand how the support matters here.

For example, I would have expected stats.wasserstein_distance([0,1,0],[1,0,0]) to be 1 (as we need to move a mass of weight 1 by a distance of 1), however it is 0. Why is this?

I know this is related to this question: what does the Wasserstein distance between two distributions quantify.

My understanding is that the Wasserstein distance is the earth-movers distance; thus, it would be that it is able to show a further distance between delta-function like probability distributions where the peaks are not aligned but further apart - eg, the difference between distributions of two variables with cardinality four [1,0,0,0] and [0,0,1,0] should be higher than between distributions [1,0,0,0] and [0,1,0,0]. The Jensen-Shannon divergence would be the , where the same in both cases. However, in the scipy implementation the Wasserstein distance is zero in both cases also.

Edit: This question was closed without an explanation and despite an upvote.

Thankfully, I found the answer here: https://stackoverflow.com/questions/57402842/why-is-the-wasserstein-distance-between-0-1-and-1-0-zero — I also asked on stackoverflow before asking here and have clarified things there, but in short, the Wasserstein distance from scipy does NOT calculate the distance between two distributions P(A) and P(B) where A and B have the same support but different probabilities for each state; rather, it calculates the difference between different samples of a single distribution.

Edit 2: You can use the scipy implementation for this but need to use the weights. Summary is here: https://stackoverflow.com/questions/76049158/wasserstein-distance-in-scipy-definition-of-support/76061410#76061410



Browse other questions tagged or ask your own question.