6
$\begingroup$

I know the earth mover's distance is implemented here :

https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.wasserstein_distance.html

I need to compute the p-Wasserstein distance between two 1d distributions ( or samples from these distributions). The p-WD is given as follows

enter image description here

Anybody familiar with a Python implementation of the p-Wasserstein distance? anyhelp is appreciated!

$\endgroup$

1 Answer 1

11
$\begingroup$

This is implemented in the POT: Python Optimal Transport package, for samples (or, generally, discrete measures): use ot.wasserstein_1d. If you want to do it for weighted samples (or general discrete distributions with finite support), you can provide the a and b arguments.

$\endgroup$
2
  • $\begingroup$ Thanks, do you know if n-d is supported as well in this library ? $\endgroup$
    – Steve
    Feb 11, 2020 at 2:17
  • 1
    $\begingroup$ Yes; there are various versions with different computation / accuracy tradeoffs depending on the sample size / dimension / etc. $\endgroup$
    – Danica
    Feb 11, 2020 at 6:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.