-
Notifications
You must be signed in to change notification settings - Fork 98
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Earth Mover's Distance/Wasserstein metric #37
Comments
Would also be neat to see the Sinkhorn distance, or entropy-regularized Wasserstein norm. |
We always accept PRs, so if anyone is interested in adding those metrics to this package, it would certainly be welcome. |
In the context of this package, is there a sensible way to provide an arbitrary cost function when constructing the norm? Or would that not make sense with the design? Another option would just be to provide specific subtypes for the 1-, 2-, and max-norms. But arbitrary cost functions fit better with the general idea. Likewise for the entropy-regularized case, the type would have to be parameterized with a float coefficient. Is this also reasonable? |
Also, I've just noticed that the norms seem to work well for numbers as well as vectors. Would it be reasonable to define something like This is a very clean and minimal library so I don't want to overcomplicate things. |
I made a small wrapper of the original EMD implementation by Rubner, the inventor of the Earth Mover Distance: https://github.com/mirkobunse/EarthMoversDistance.jl The wrapper only supports one-dimensional histograms for now, but it is easily extensible. The original wrapped algorithm can compute the EMD of any two distributions. Already, the wrapper allows you to define arbitrary ground distances. I'd appreciate your support in extending the project! Comments are welcome, as well. Ultimately, I hope that the wrapper helps in implementing the EMD natively in Julia, e.g., in the Distances package. Specifically, efficient special-case algorithms would be great. My wrapper can be used to test such implementations. |
I wrote a really basic pure julia EMD script here: https://discourse.julialang.org/t/computing-discrete-wasserstein-emd-distance-in-julia/9600/10?u=ckneale Not sure if this is still of interest but I did see this is an open issue. |
EMD is useful for calculating distances between histograms or distributions. It would be cool to see it added to Distances.jl
https://en.wikipedia.org/wiki/Earth_mover's_distance
The text was updated successfully, but these errors were encountered: