Gromov-Wasserstein Barycenter
gwbary.RdComputes the Gromov–Wasserstein (GW) barycenter of a collection of metric measure spaces. Given a list of distance matrices \({D^{(k)}}{k=1}^K\) and their corresponding marginal distributions, the function estimates a synthetic symmetric dissimilarity space representing the input collection under a local GW squared-loss criterion. Triangle inequalities are not imposed, so the returned object need not be a metric space. Global optimality is not certified.
The GW barycenter is defined as the minimizer of a multi-measure Gromov–Wasserstein objective, where each dataset contributes according to a user-specified barycentric weight. Since the problem is jointly non-convex in the barycenter metric and the coupling matrices, the algorithm proceeds through an outer–inner iterative procedure.
Arguments
- distances
a length-\(K\) list where each element is either an \((N_k \times N_k)\) distance matrix or an object of class
distrepresenting the pairwise distances for each empirical measure.- marginals
marginal distributions for empirical measures; if
NULL(default), uniform weights are set for all measures. Otherwise, it should be a length-\(K\) list where each element is a length-\(N_k\) vector of nonnegative weights that sum to 1.- weights
weights for each individual measure; if
NULL(default), each measure is considered equally. Otherwise, it should be a length-\(K\) vector.- num_support
the number of support points \(M\) for the barycenter (default: 100).
- ...
extra parameters including
- maxiter
maximum number of iterations (default: 10).
- abstol
stopping criterion for iterations (default: 1e-6).
- method
GW comparison method:
"mm","pg", or"fw"(default); seegwdist.- inner_maxiter, inner_tol
GW comparison iteration limit and tolerance (defaults: 100, 1e-8).
- transport_maxiter
exact transport iteration limit (default: 100000000; zero means no limit).
- init_dist
optional initial symmetric zero-diagonal dissimilarity matrix.
- projection_maxiter, projection_tol, max_backtrack
PG controls passed to
gwdist.
Value
A named list containing
- dist
an object of class
distrepresenting the attained dissimilarity barycenter; a metric is not guaranteed.- weight
a length-\(M\) vector of fixed barycenter masses with all entries being \(1/M\). Status, objective history, dissimilarity matrix, and pairwise diagnostics are also returned.
Examples
if (FALSE) { # \dontrun{
#-------------------------------------------------------------------
# Description
#
# GW barycenter computation is quite expensive. In this example,
# we draw a small set of empirical measures from the digit '3'
# images and compute their GW barycenter with a small number of
# support points. The attained barycenter distance matrix is then
# passed onto the classical MDS algorithm for visualization.
#-------------------------------------------------------------------
## GENERATE DATA
data(digit3)
data_D = vector("list", length=5)
data_W = vector("list", length=5)
for (i in 1:5){
img_now = img2measure(digit3[[i]])
data_D[[i]] = stats::dist(img_now$support)
data_W[[i]] = as.vector(img_now$weight)
}
## COMPUTE
bary_dist <- gwbary(data_D, marginals=data_W, num_support=100)
bary_cmd2 <- stats::cmdscale(bary_dist$dist, k=2)
## VISUALIZE
opar <- par(no.readonly=TRUE)
par(pty="s")
plot(bary_cmd2, main="GW Barycenter Embedding",
xaxt="n", yaxt="n", pch=19, xlab="", ylab="")
par(opar)
} # }