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


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!


1 Answer 1


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.

  • $\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.