Conversation
|
I would say the main issue of introducing this PR is its huge dependency. You know, at present this package is quite small julia> @time using Distances
0.078969 seconds (52.74 k allocations: 3.509 MiB)Probably this package isn't the best place to put the codes to |
Yes, this PR introduces a lot of dependencies. But since you need to solve a (possibly large) linear program in order to calculate the Wasserstein distance, you need to introduce at least some dependencies (granted that you don't want to re-implement a linear program solver on your own)... So what do you think would be a better place for the code? And what do others think? |
|
Another implementation (though solved quite differently) is in #159. Don't really know about the implementation there though. |
|
FYI: https://github.com/JuliaOptimalTransport/OptimalTransport.jl contains specialized implementations for the 1D solution, both for discrete and continuous distributions, but also a pure Julia implementation for solving the optimal transport problem with discrete measures in arbitrary dimensions (and soon there will be also a specialized implementation for multivariate normal distributions). We just added |
|
Adding JuMP as a dependency to Distances.jl would certainly be a problem. As noted at #159 (comment), the 1D Wasserstein distance has a closed form solution, and Distances.jl only includes 1D distances, so we should use that. |
|
We started splitting OptimalTransport.jl into smaller subpackages, the Wasserstein distances, based on MOI in the general case and including special cases as 1D and e.g. Gaussian distributions, are moved to https://github.com/JuliaOptimalTransport/ExactOptimalTransport.jl. |
This PR adds the p-Wasserstein distance (a.k.a. Earth Mover Distance). Calculating the p-Wasserstein entails solving a linear program. This is done using JuMP.jl with the Cbc.jl optimizer.
Fixes #37