Skip to contents

Full transport is cubic in the sample size and its gradient touches every point, which is unusable inside a training loop. Averaging over minibatches costs a constant per step, but it is a genuinely different functional: the minibatch loss is not zero between a measure and itself, and it does not vanish only at equality.

Usage

Otmm(X, Y, batch_size, n_batches, epsilon)

Arguments

X, Y

Two point clouds.

batch_size

Points per batch.

n_batches

Number of batches.

epsilon

Entropic strength, positive.

Value

List with loss, per_batch, batch_size, n_batches, n, m, d.

Details

Formula: (1/M) sum_m OT_eps(X_m, Y_m) over M batches – Fatras et al. (2020) eq. (3). The batches here are consecutive slices, taken cyclically, so the estimate is deterministic.

References

Fatras, K., Zine, Y., Flamary, R., Gribonval, R. and Courty, N. (2020). Proceedings of Machine Learning Research 108:2131-2141 (AISTATS).

Examples

set.seed(1)
r <- Otmm(X = rnorm(10), Y = rnorm(10), batch_size = 8L, n_batches = 8L, epsilon = 0.5); TRUE
#> [1] TRUE