Skip to contents

Hard marginal constraints force every unit of mass to be matched, which is exactly wrong when one measure is a noisy or truncated view of the other – an outlier then drags a long-distance flow. Replacing the constraints with KL penalties lets mass be created and destroyed at price lam; lam -> Inf recovers the balanced problem.

Usage

Otunbal(a, b, C, epsilon, lam, max_iter = 200)

Arguments

a, b

Marginals; the totals need not agree.

C

Ground cost, n by m.

epsilon

Entropic strength, positive.

lam

Marginal-relaxation strength, positive.

max_iter

Scaling sweeps.

Value

List with T, cost, mass, mass_a, mass_b, n, m.

Details

Formula: min_T <T,C> + eps H(T) + lam KL(T 1 | a) + lam KL(T' 1 | b)}, solved by \code{u <- (a/(K v))^(lam/(lam+eps))}, \eqn{v <- (b/(K' u))^(lam/(lam+eps)) – Peyre and Cuturi (2019) eq. (10.8)-(10.9), p. 163; Chizat et al. (2018).

References

Chizat, L., Peyre, G., Schmitzer, B. and Vialard, F.-X. (2018). Mathematics of Computation 87(314):2563-2609. doi:10.1090/mcom/3303 .

Examples

C <- outer(1:3, 1:3, function(i, j) (i - j)^2)
r <- Otunbal(a = c(0.5, 0.5, 0), b = c(0, 0.5, 1), C = C, epsilon = 0.1, lam = 1)
c(r$mass_a, r$mass_b, r$mass)   # unequal totals: mass is created and destroyed at a KL price
#> [1] 1.0000000 1.5000000 0.8212697