Skip to contents

The regularised cost OT_eps(mu, mu) is not zero, so OT_eps alone is not a divergence and a generative model trained on it drifts towards a blurred target. Subtracting half of each self-cost fixes that: the result is zero exactly when the two measures coincide.

Usage

Otdiv(a, b, Cab, Caa, Cbb, epsilon, max_iter = 200)

Arguments

a, b

The two histograms.

Cab

Cross cost, n by m.

Caa

Cost of a against itself, n by n.

Cbb

Cost of b against itself, m by m.

epsilon

Regularisation strength, positive.

max_iter

Sinkhorn sweeps.

Value

List with S_eps, OT_ab, OT_aa, OT_bb, n, m.

Details

Formula: \(S_eps(mu,nu) = OT_eps(mu,nu) - 0.5 (OT_eps(mu,mu) + OT_eps(nu,nu))\) with \(OT_eps(mu,nu) = <T*,C> + eps KL(T* | mu x nu)\) – Genevay, Peyre and Cuturi (2018) eq. (3)-(4).

References

Genevay, A., Peyre, G. and Cuturi, M. (2018). Proceedings of Machine Learning Research 84:1608-1617 (AISTATS).

Examples

x <- 1:4
C <- outer(x, x, function(a, b) (a - b)^2)
a <- c(0.4, 0.3, 0.2, 0.1)
Otdiv(a, a, C, C, C, epsilon = 0.5)$S_eps              # 0 for identical measures
#> [1] 0
Otdiv(a, rev(a), C, C, C, epsilon = 0.5)$S_eps
#> [1] 1.178869