Solved – P Wasserstein distance in Python

machine learningmathematical-statisticspythonscipy

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!

Best Answer

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.

Related Question