Learn R Programming

transport

R package for solving a wide range of optimal transport problems, both balanced and unbalanced, with dedicated methods for 1-d transport, images, point masses in space and semidiscrete transport. You can compute Wassserstein distances and their underlying optimal transport plans and display the results graphically in a number of ways.

Installation

Install the latest stable version from CRAN by saying in R

install.packages("transport")

or install the development version from GitHub by saying in R

remotes::install_github("dschuhmacher/transport")

Getting started

Check the help page for transport and possibly unbalanced, wasserstein and wasserstein1d.

History

The transport package was started in 2013 with two simple algorithms for optimal transport between images that were mainly intended for computations and evaluations of methods in the local research group. Since 2014, I have submitted new versions to CRAN on a regular basis. Over time the package has grown into a larger but somewhat unruly collection of methods and convenience functions with substantial code contributions from colleagues and staff members. I have finally created this GitHub repository in 2024 in order to collect more direct feedback and possibly some code contributions to help grinding down some of the rough edges and reaching version 1.0.

Citation

Most of us have to justify the time they invest in their projects by some kind of performance measure. If you use this package in publications, please do cite it as

D. Schuhmacher, B. Bähre, N. Bonneel, C. Gottschlich, V. Hartmann, F. Heinemann, B. Schmitzer and J. Schrieber (2024). transport: Computation of Optimal Transport Plans and Wasserstein Distances. R package version 0.15-0. https://cran.r-project.org/package=transport

Contributions

Any contributions are welcome from filing individual bug reports (please give a reproducible example!) over suggestions for improvements to pull requests with new features. A more detailed guide for contributing will be added soon.

Copy Link

Version

Install

install.packages('transport')

Monthly Downloads

2,207

Version

0.15-4

License

GPL (>= 2)

Last Published

September 16th, 2024

Functions in transport (0.15-4)

semidiscrete1

Compute Semidiscrete Optimal Transport for Euclidean Distance Cost
semidiscrete

Find Optimal Transport Partition Between pgrid and wpp.
trcontrol

Set the Control Parameters Used by transport.
shielding

Compute Optimal Transport (Cost/Plan) Using the Multiscale Shielding Method
starting solutions

Compute starting solution for the transportation problem
transport_track

Create a Dynamic Visualization of a Transference Plan Between Two pgrids
ret_message

Return Text Strings for lbfgs Return Codes
subwasserstein

Approximate Computation of Wasserstein Distances via Subsampling.
transport-package

Optimal Transport in Various Forms
transport-internal

Internal Functions in Package ‘transport’
pp

Constructor for the pp Class
power_diagram

Compute the Power Diagram of Weighted Sites in 2-Dimensional Space
unbalanced

Unbalanced Optimal Transport Between Two Objects
transport

Find Optimal Transport Plan Between Two Objects
wpp

Constructor for the wpp Class
wasserstein

Compute the Wasserstein Distance Between Two Objects
wpp-object

Class of Weighted Point Patterns
wasserstein1d

Compute the Wasserstein Distance Between Two Univariate Samples
methods

Print and Summary Methods for Objects of Class pgrid, pp and wpp
matimage

Plotting Matrices as Images
pgrid-object

Class of Pixel Grids
all.equal (transport objects)

Methods for Judging Near Equality of Objects of Class pgrid, pp or wpp
plot.ut_pgrid

Plot Unbalanced Transport Information
aha

Solve Transportation Problem by Aurenhammer--Hoffmann--Aronov Method
plot

Methods for Plotting Objects of Class pgrid, pp and wpp
plot.ut_wpp

Plot Unbalanced Transport Information
compatible

Test whether Two Objects are Compatible
plot_apollonius

Plot Apollonius Diagram
random

Images to Illustrate the Use of transport.pgrid
pgrid

Constructor for the pgrid Class
pp-object

Class of (Unweighted) Point Patterns