subwasserstein: Approximate Computation of Wasserstein Distances via...

View source: R/subsampling.R

subwassersteinR Documentation

Approximate Computation of Wasserstein Distances via Subsampling.

Description

Samples S elements each of a source and a target measure and computes the Wasserstein distance between the samples. The mean distance out of K tries is returned.

Usage

subwasserstein(
  source,
  target,
  S,
  K = 1,
  p = 1,
  costM = NULL,
  prob = TRUE,
  precompute = FALSE,
  method = "networkflow"
)

Arguments

source

The source measure has to be either a weight vector or an object of one of the classes "pgrid", "wpp" or "pp".

target

The target measure needs to be of the same type as the source measure.

S

The sample size.

K

The number of tries. Defaults to 1.

p

The order of the Wasserstein metric (i.e. the power of the distances). Defaults to 1.

costM

The cost matrix between the source and target measures. Ignored unless source and target are weight vectors.

prob

logical. Should the objects a, b be interpreted as probability measures, i.e. their total mass be normalized to 1?

precompute

logical. Should the cost matrix for the large problem be precomputed?

method

A string with the name of the method used for optimal transport distance computation. Options are "revsimplex", "shortsimplex" and "primaldual". Defaults to "revsimplex".

Details

For larger problems setting precompute to TRUE is not recommended.

Value

The mean of the K values of the Wasserstein distances between the subsampled measures.

Author(s)

Jörn Schrieber joern.schrieber-1@mathematik.uni-goettingen.de
Dominic Schuhmacher dominic.schuhmacher@mathematik.uni-goettingen.de

References

M. Sommerfeld, J. Schrieber, Y. Zemel and A. Munk (2018) Optimal Transport: Fast Probabilistic Approximation with Exact Solvers preprint: arXiv:1802.05570

Examples

## Not run: 
subwasserstein(random64a, random64b, S=1000)
wasserstein(random64a, random64b)

## End(Not run)


transport documentation built on July 9, 2023, 7:43 p.m.