Skip to contents

A fixed grid forces the barycentre onto points that may all be far from the data, which in more than two dimensions is fatal. Letting the atoms move turns the problem into an alternating scheme – solve the transports, then move each atom to the weighted average of the mass it received – which is Lloyd's algorithm with a transport plan in place of the nearest-point assignment.

Usage

Otbarfree(X_list, weights, n_supp, max_iter = 20)

Arguments

X_list

List of input point clouds, each n_k by d.

weights

Barycentric weights; rescaled to sum to one.

n_supp

Number of support atoms.

max_iter

Alternations.

Value

List with Y, weights_y, cost, n_supp, d, K, iters.

Details

Formula: alternate T_k = argmin <T, C(Y, X_k)> and Y <- n sum_k w_k T_k X_k – Cuturi and Doucet (2014) Section 4. Uniform weights are kept on the support throughout.

References

Cuturi, M. and Doucet, A. (2014). Proceedings of Machine Learning Research 32:685-693 (ICML).

Examples

set.seed(9)
X1 <- matrix(rnorm(20, -2), 10, 2); X2 <- matrix(rnorm(20, 2), 10, 2)
b <- Otbarfree(list(X1, X2), weights = c(0.5, 0.5), n_supp = 5)
round(colMeans(b$Y), 2)   # near the midpoint (0, 0)
#> [1]  0.13 -0.09