Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Can POT be used to compute Wasserstein-2 distance between 2D distributions? #479

Answered by arakotom
FabianoVeglianti asked this question in Q&A
Discussion options

It seems to me that, at the moment, POT doesn't have an API to compute the Wasserstein-2 distance, but I would like to have a confirmation from you because I could be wrong.
Specifically, I need to compute the Wasserstein-2 distance between a Gaussian distribution and a set of data.

Obviously if the answer is :"yes, you can compute it", please tell me also how ^^.

You must be logged in to vote

Hi,

yes you can compute it. for 2D data, if you have samples then you can use the code in this examples
https://github.com/PythonOT/POT/blob/master/examples/plot_OT_2D_samples.py

and it also works for higher dimensional data as long as you have samples.

Replies: 1 comment 1 reply

Comment options

Hi,

yes you can compute it. for 2D data, if you have samples then you can use the code in this examples
https://github.com/PythonOT/POT/blob/master/examples/plot_OT_2D_samples.py

and it also works for higher dimensional data as long as you have samples.

You must be logged in to vote
1 reply
Comment options

Ah, ok, thank you! I saw the emd2 function but I was deceived by the name "emd" which stands (I think) for "earth mover's distance" and on wikipedia I read that the earth mover's distance is the Wasserstein-1, so I skipped that. Also I didn't think about the fact that the emd2 function accepts a matrix M of costs and that differents costs would lead to differents distances.

Anyway, thank you!

Answer selected by FabianoVeglianti
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /