JuliaOptimalTransport / OptimalTransport.jl

Optimal transport algorithms for Julia
https://juliaoptimaltransport.github.io/OptimalTransport.jl/dev
MIT License
93 stars 8 forks source link
julia optimal-transport optimal-transport-algorithms optimization scaling-algorithms sinkhorn-algorithm wasserstein wasserstein-distance

OptimalTransport.jl

CI GPU tests DOI Codecov Coveralls Code Style: Blue

This package provides some Julia implementations of algorithms for computational optimal transport, including the Earth-Mover's (Wasserstein) distance, Sinkhorn algorithm for entropically regularized optimal transport as well as some variants or extensions.

Notably, OptimalTransport.jl provides GPU acceleration through CUDA.jl and NNlibCUDA.jl.

This package is inspired by the Python Optimal Transport package.

Example

using OptimalTransport
using Distances

# uniform histograms
μ = fill(1/250, 250)
ν = fill(1/200, 200)

# random cost matrix
C = pairwise(SqEuclidean(), rand(1, 250), rand(1, 200); dims=2)

# regularization parameter
ε = 0.01

# solve entropically regularized optimal transport problem
sinkhorn(μ, ν, C, ε)

Please see the documentation pages for further information.

Related packages

Contributing

Contributions are more than welcome! Please feel free to submit an issue or pull request in this repository.

Acknowledgements

Contributors include:

References