{'fraction_non_alphanumeric': 0.04031929347826087, 'fraction_numerical': 0.01484375, 'mean_word_length': 4.267668634818393, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 2, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Fast Computation of Wasserstein Barycenters

We present new algorithms to compute the mean of a set of empirical probability measures under the optimal transport metric. This mean, known as the Wasserstein barycenter, is the measure that minimizes the sum of its Wasserstein distances to each element in that set. We propose two original algorithms to compute Wasserstein barycenters that build upon the subgradient method. A direct implementation of these algorithms is, however, too costly because it would require the repeated resolution of large primal and dual optimal transport problems to compute subgradients. Extending the work of Cuturi (2013), we propose to smooth the Wasserstein distance used in the definition of Wasserstein barycenters with an entropic regularizer and recover in doing so a strictly convex objective whose gradients can be computed for a considerably cheaper computational cost using matrix scaling algorithms. We use these algorithms to visualize a large family of images and to solve a constrained clustering problem.


Introduction
Comparing, summarizing and reducing the dimensionality of empirical probability measures defined on a space Ω are fundamental tasks in statistics and machine learning. Such tasks are usually carried out using pairwise comparisons of measures. Classic information divergences (Amari and Nagaoka, 2001) are widely used to carry out such comparisons.
Unless Ω is finite, these divergences cannot be directly applied to empirical measures, because they are ill-defined for measures that do not have continuous densities. They  Mean measures using the (a) Euclidean distance (b) Euclidean after re-centering images (c) Jeffrey centroid (Nielsen, 2013) (d) RKHS distance (Gaussian kernel, σ = 0.002) (e) 2-Wasserstein distance. also fail to incorporate prior knowledge on the geometry of Ω, which might be available if, for instance, Ω is also a Hilbert space. Both of these issues are usually solved using Parzen's approach (1962) to smooth empirical measures with smoothing kernels before computing divergences: the Euclidean (Gretton et al., 2007) and χ 2 distances (Harchaoui et al., 2008), the Kullback-Leibler and Pearson divergences (Kanamori et al., 2012a;b) can all be computed fairly efficiently by considering matrices of kernel evaluations.
The choice of a divergence defines implicitly the mean element, or barycenter, of a set of measures, as the particular measure that minimizes the sum of all its divergences to that set of target measures (Veldhuis, 2002;Banerjee et al., 2005;Teboulle, 2007;Nielsen, 2013). The goal of this paper is to compute efficiently barycenters (possibly in a constrained subset of all probability measures on Ω) defined by the optimal transport distance between measures (Villani, 2009, §6). We propose to minimize directly the sum of optimal transport distances from one measure (the variable) to a set of fixed measures by gradient descent. These gradients can be computed for a moderate cost by solving smoothed optimal transport problems as proposed by Cuturi (2013).
Wasserstein distances have many favorable properties, documented both in theory (Villani, 2009) and practice (Rubner et al., 1997;Pele and Werman, 2009). We argue that their versatility extends to the barycenters they define. We illustrate this intuition in Figure 1, where we consider 30 images of nested ellipses on a 100 × 100 grid. Each image is a discrete measure on [0, 1] 2 with normalized intensities. Computing the Euclidean, Gaussian RKHS mean-maps or Jeffrey centroid of these images results in mean measures that hardly make any sense, whereas the 2-Wasserstein mean on that grid (defined in §3.1) produced by Algorithm 1 captures perfectly the structure of these images. Note that these results were recovered without any prior knowledge on these images other than that of defining a distance in [0, 1] 2 , here the Euclidean distance. Note also that the Gaussian kernel smoothing approach uses the same distance, in addition to a bandwidth parameter σ which needs to be tuned in practice. This paper is organized as follows: we provide background on optimal transport in §2, followed by the definition of Wasserstein barycenters with motivating examples in §3. Novel contributions are presented from §4: we present two subgradient methods to compute Wasserstein barycenters, one which applies when the support of the mean measure is known in advance and another when that support can be freely chosen in Ω. These algorithms are very costly even for measures of small support or histograms of small size. We show in §5 that the key ingredients of these approaches-the computation of primal and dual optimal transport solutions-can be bypassed by solving smoothed optimal transport problems. We conclude with two applications of our algorithms in §6.

Background on Optimal Transport
Let Ω be an arbitrary space, D a metric on that space and P (Ω) the set of Borel probability measures on Ω. For any point x ∈ Ω, δ x is the Dirac unit mass on x.

Restriction to Empirical Measures
We will only consider empirical measures throughout this paper, that is measures of the form µ = n i=1 a i δ xi where n is an integer, X = (x 1 , . . . , x n ) ∈ Ω n and (a 1 , . . . , a n ) lives in the probability simplex Σ n ,

Let us introduce additional notations:
Measures on a Set X with Constrained Weights. Let Θ be a non-empty closed subset Θ of Σ n . We write Measures supported on up to k points. Given an integer k and a subset Θ of Σ k , we consider the set P k (Ω, Θ) of measures of Ω that have discrete support of size up to k and weights in Θ, When no constraints on the weights are considered, namely when the weights are free to be chosen anywhere on the probability simplex, we use the shorter notations P (X) def = P (X, Σ n ) and P k (Ω) def = P k (Ω, Σ k ).

Wasserstein & Discrete Optimal Transport
Consider two families X = (x 1 , . . . , x n ) and Y = (y 1 , . . . , y m ) of points in Ω. When µ = n i=1 a i δ xi and ν = n i=1 b i δ yi , the Wasserstein distance W p (µ, ν) between µ and ν is the p th root of the optimum of a network flow problem known as the transportation problem (Bertsimas and Tsitsiklis, 1997, §7.2). This problem builds upon two elements: the matrix M XY of pairwise distances between elements of X and Y raised to the power p, which acts as a cost parameter, and the transportation polytope U (a, b) of a ∈ Σ n and b ∈ Σ m , which acts as a feasible set, defined as the set of n × m nonnegative matrices such that their row and column marginals are equal to a and b respectively. Writing 1 n for the n-dimensional vector of ones, be the Frobenius dot-product of matrices. Combining Eq. (1) & (2), we have that W p p (µ, ν)-the distance W p (µ, ν) raised to the power pcan be written as the optimum of a parametric linear program p on n × m variables, parameterized by the marginals a, b and a (cost) matrix M XY :

Wasserstein Barycenters
We present in this section the Wasserstein barycenter problem, a variational problem involving all Wasserstein distances from one to many measures, and show how it encompasses known problems in clustering and approximation.

Definition and Special Cases
Definition 2 (Agueh and Carlier, 2011). A Wasserstein barycenter of N measures {ν 1 , . . . , ν N } in P ⊂ P (Ω) is a minimizer of f over P, where Agueh and Carlier consider more generally a non-negative weight λ i in front of each distance W p p (µ, ν i ). The algorithms we propose extend trivially to that case but we use uniform weights in this work to keep notations simpler.
We highlight a few special cases where minimizing f over a set P is either trivial, relevant to data analysis and/or has been considered in the literature with different tools or under a different name. In what follows X ∈ Ω n and Y ∈ Ω m are arbitrary finite subsets of Ω.
• N = 1, P = P (X) When only one measure ν, supported on Y ∈ Ω m is considered, its closest element µ in P (X)-if no constraints on weights a are given-can be computed by defining a weight vector a on the elements of X that results from assigning all of the mass b i to the closest neighbor in metric D of y i in X.
When Ω is a set of size d and a matrix M ∈ R d×d + describes the pairwise distances between these d points (usually called in that case bins or features), the 1-Wasserstein distance is known as the Earth Mover's Distance (EMD) (Rubner et al., 1997). In that context, Wasserstein barycenters have also been called EMD prototypes by Zen and Ricci (2011).
is a Euclidean metric space and p = 2 is equivalent to the k-means problem (Pollard, 1982;Canas and Rosasco, 2012).
Consider a measure ν with support Y ∈ Ω m and weights b ∈ Σ m . The problem of approximating this measure by a uniform measure with k atoms-a measure in P k (Ω, {1 k /k})-in 2-Wasserstein sense was to our knowledge first considered by Ng (2000), who proposed a variant of Lloyd's algorithm (1982) for that purpose. More recently, Reich (2013) remarked that such an approximation can be used in the resampling step of particle filters and proposed in that context two ensemble methods inspired by optimal transport, one of which reduces to a single iteration of Ng's algorithm. Such approximations can also be obtained with kernel-based approaches, by minimizing an information divergence between the (smoothed) target measure ν and its (smoothed) uniform approximation as proposed recently by Chen et al. (2010) and Sugiyama et al. (2011).

Recent Work
Agueh and Carlier (2011) consider conditions on the ν i 's for a Wasserstein barycenter in P (Ω) to be unique using the multi-marginal transportation problem. They provide solutions in the cases where either (i) Ω = R; (ii) N = 2 using McCann's interpolant (1997); (iii) all the measures ν i are Gaussians in Ω = R d , in which case the barycenter is a Gaussian with the mean of all means and a variance matrix which is the unique positive definite root of a matrix equation (Agueh and Carlier, 2011, Eq.6.2). Rabin et al. (2012) were to our knowledge the first to consider practical approaches to compute Wasserstein barycenters between point clouds in R d . To do so, Rabin et al. (2012) propose to approximate the Wasserstein distance between two point clouds by their sliced Wasserstein distance, the expectation of the Wasserstein distance between the projections of these point clouds on lines sampled randomly. Because the optimal transport between two point clouds on the real line can be solved with a simple sort, the sliced Wasserstein barycenter can be computed very efficiently, using gradient descent. Although their approach seems very effective in lower dimensions, it may not work for d ≥ 4 and does not generalize to non-Euclidean metric spaces.

New Computational Approaches
We propose in this section new approaches to compute Wasserstein barycenters when (i) each of the N measures ν i is an empirical measure, described by a list of atoms Y i ∈ Ω mi of size m i ≥ 1, and a probability vector b i in the simplex Σ mi ; (ii) the search for a barycenter is not considered on the whole of P (Ω) but restricted to either P (X, Θ) (the set of measures supported on a predefined finite set X of size n with weights in a subset Θ of Σ n ) or P k (Ω, Θ) (the set of measures supported on up to k atoms with weights in a subset Θ of Σ k ).
Looking for a barycenter µ with atoms X and weights a is equivalent to minimizing f (see Eq. 3 for a definition of p), over relevant feasible sets for a and X. When X is fixed, we show in §4.1 that f is convex w.r.t a regardless of the properties of Ω. A subgradient for f w.r.t a can be recovered through the dual optimal solutions of all problems p(a, b i , M XYi ), and f can be minimized using a projected subgradient method outlined in §4.2. If X is free, constrained to be of cardinal k, and Ω and its metric D are both Euclidean, we show in §4.4 that f is not convex w.r.t X but we can provide subgradients for f using the primal optimal solutions of all problems p(a, b i , M XYi ). This in turn suggests an algorithm to reach a local minimum for f w.r.t. a and X in P k (Ω, Θ) by combining both approaches.

Differentiability of
Dual transportation problem. Given a matrix M ∈ R n×m , the optimum p(a, b, M ) admits the following dual Linear Program (LP) form (Bertsimas and Tsitsiklis, 1997, §7.6, §7.8), known as the dual optimal transport problem: where the polyhedron C M of dual variables is The dual optimal solutions-which can be easily recovered from the primal optimal solution (Bertsimas and Tsitsiklis, 1997, Eq.7.10)-define a subgradient for p as a function of a: Proof. These results follow from sensitivity analysis in LP's (Bertsimas and Tsitsiklis, 1997, §5.2). d is bounded and is also the maximum of a finite set of linear functions, each indexed by the set of extreme points of C M , evaluated at a and is therefore polyhedral convex. When the dual optimal vector is unique, α ⋆ is a gradient of p at a, and a subgradient otherwise.
Because for any real value t the pair (α + t1 n , β − t1 m ) is feasible if the pair (α, β) is feasible, and because their objective are identical, any dual optimum (α, β) is determined up to an additive constant. To remove this degree of freedom-which arises from the fact that one among all n+m row/column sum constraints of U (a, b) is redundantwe can either remove a dual variable or normalize any dual optimum α ⋆ so that it sums to zero, to enforce that it belongs to the tangent space of Σ n . We follow the latter strategy in the rest of the paper.

Fixed Support: Minimizing f over P (X)
Let X ⊂ Ω n be fixed and let Θ be a closed convex subset of Σ n . The aim of this section is to compute weights a ∈ Θ such that f (a, X) is minimal. Let α ⋆ i be the optimal dual variable of d(a, b i ; M XYi ) normalized to sum to 0. f being a sum of terms p(a, b i , M XYi ), we have that: Assuming Θ is closed and convex, we can consider a naive projected subgradient minimization of f . Alternatively, if there exists a Bregman divergence B(a, b) = ω(b) − ω(a) − ∇ω(a), b − a for a, b ∈ Θ defined by a proxfunction ω, we can define the proximal mapping P a (b) = argmin c∈Θ ( b, c − a + B(a, c)) and consider accelerated gradient approaches (Nesterov, 2005). We summarize this idea in Algorithm 1.
Notice that when Θ = Σ n and B is the Kullback-Leibler divergence (Beck and Teboulle, 2003), we can initializeã with 1 n /n and use the multiplicative update to realize the proximal update:ã ←ã • e −t0βα α α ;ã ←ã/ã T 1 n , where • is Schur's product. Alternative sets Θ for which this projection can be easily carried out include, for instance, all (convex) level set of the entropy function H, namely Θ = {a ∈ Σ n |H(a) ≥ τ } where 0 ≤ τ ≤ log n.
Algorithm 1 Wasserstein Barycenter in P (X, Θ) We consider now the case where Ω = R d with d ≥ 1, D is the Euclidean distance and p = 2. When Ω = R d , a family of n points X and a family of m points Y can be represented respectively as a matrix in R d×n and another in R d×m . The pairwise squared-Euclidean distances between points in these sets can be recovered by writing x def = diag(X T X) and y def = diag(Y T Y ), and observing that . Transport Cost as a function of X. Due to the margin constraints that apply if a matrix T is in the polytope U (a, b), we have: Discarding constant terms in y and b, we have that minimizing p(a, b, M XY ) with respect to locations X is equivalent to solving min X∈R d×k x T a + p(a, b, −X T Y ).
As a function of X, that objective is the sum of a convex quadratic function of X with a piecewise linear concave function, since is the minimum of linear functions indexed by the vertices of the polytope U (a, b). As a consequence, p(a, b, M XY ) is not convex with respect to X.
Quadratic Approximation. Suppose that T ⋆ is optimal for problem p(a, b, M XY ). Updating Eq. (7), Minimizing a local quadratic approximation of p at X yields thus the Newton update A simple interpretation of this update is as follows: the matrix T ⋆T diag(a −1 ) has n column-vectors in the simplex Σ m . The suggested update for X is to replace it by n barycenters of points enumerated in Y with weights defined by the optimal transport T ⋆ . Note that, because the minimization problem we consider in X is not convex to start with, one could be fairly creative when it comes to choosing D and p among other distances and exponents. This substitution would only involve more complicated gradients of M XY w.r.t. X that would appear in Eq. (7).

Free Support: Minimizing
We now consider, as a natural extension of §4.2 when Ω = R d , the problem of minimizing f over a probability measure µ that is (i) supported by at most k atoms described in X, a matrix of size d × k, (ii) with weights in a ∈ Θ ⊂ Σ k .

Alternating Optimization.
To obtain an approximate minimizer of f (a, X) we propose in Algorithm 2 to update alternatively locations X (with the Newton step defined in Eq. 8) and weights a (with Algorithm 1).

Algorithm 2 2-Wasserstein Barycenter in
initialize X ∈ R d×k and a ∈ Θ while X and a have not converged do a ← a ⋆ using Algorithm 1.
ting θ ∈ [0, 1] with line-search or a preset value. end while Algorithm 2 and Lloyd/Ng Algorithms. As mentioned in §2, minimizing f defined in Eq. (5) over P k (R d ), with N = 1, p = 2 and no constraints on the weights (Θ = Σ k ), is equivalent to solving the k-means problem applied to the set of points enumerated in ν 1 . In that particular case, Algorithm 2 is also equivalent to Lloyd's algorithm. Indeed, the assignment of the weight of each point to its closest centroid in Lloyd's algorithm (the maximization step) is equivalent to the computation of a ⋆ in ours, whereas the re-centering step (the expectation step) is equivalent to our update for X using the optimal transport, which is in that case the trivial transport that assigns the weight (divided by N ) of each atom in Y i to its closest neighbor in X. When the weight vector a is constrained to be uniform (Θ = {1 k /k}), Ng (2000) proposed a heuristic to obtain uniform k-means that is also equivalent to Algorithm 2, and which also relies on the repeated computation of optimal transports. For more general sets Θ, Algorithm 1 ensures that the weights a remain in Θ at each iteration of Algorithm 2, which cannot be guaranteed by neither Lloyd's nor Ng's approach.
Algorithm 2 and Reich's (2013) Transform. Reich (2013) has recently suggested to approximate a weighted measure ν by a uniform measure supported on as many atoms. This approximation is motivated by optimal transport theory, notably asymptotic results by McCann (1995), but does not attempt to minimize, as we do in Algorithm 2, any Wasserstein distance between that approximation and the original measure. This approach results in one application of the Newton update defined in Eq. (8), when X is first initialized to Y and a = 1 m /m to compute the optimal transport T ⋆ .

Summary
We have proposed two original algorithms to compute Wasserstein barycenters of probability measures: one which applies when the support of the barycenter is fixed and its weights are constrained to lie in a convex subset Θ of the simplex, another which can be used when the support can be chosen freely. These algorithms are relatively simple, yet-to the best of our knowledge-novel. We suspect these approaches were not considered before because of their prohibitive computational cost: Algorithm 1 computes at each iteration the dual optima of N transportation problems to form a subgradient, each with n + m i variables and n × m i inequality constraints. Algorithm 2 incurs an even higher cost, since it involves running Algorithm 1 at each iteration, in addition to solving N primal optimal transport problems to form a subgradient to update X. Since both objectives rely on subgradient descent schemes, they are also likely to suffer from a very slow convergence. We propose to solve these issues by following Cuturi's approach (2013) to smooth the objective f and obtain strictly convex objectives whose gradients can be computed more efficiently.

Smoothed Dual and Primal Problems
To circumvent the major computational roadblock posed by the repeated computation of primal and dual optimal transports, we extend Cuturi's approach (2013) to obtain smooth and strictly convex approximations of both primal and dual problems p and d. The matrix scaling approach advocated by Cuturi was motivated by the fact that it provided a fast approximation p λ to p. We show here that the same approach can be used to smooth the objective f and recover for a cheap computational price its gradients w.r.t. a and X.

Regularized Primal and Smoothed Dual
A n × m transport T , which is by definition in the nmsimplex, has entropy h(T ) def = − n,m i,j=1 t ij log(t ij ). Cuturi (2013) has recently proposed to consider, for λ > 0, a regu-larized primal transport problem p λ as We introduce in this work its dual problem, which is a smoothed version of the original dual transportation problem, where the positivity constraints of each term m ij − α i − β j have been replaced by penalties 1 λ e −λ(mij −αi−βj) : These two problems are related below in the sense that their respective optimal solutions are linked by a unique positive vector u ∈ R n + : Proposition 2. Let K be the elementwise exponential of −λM XY , K def = e −λMXY . Then there exists a pair of vectors (u, v) ∈ R n + × R m + such that the optimal solutions of p λ and d λ are respectively given by Proof. The result follows from the Lagrange method of multipliers for the primal as shown by Cuturi (2013, Lemma 2), and a direct application of first-order conditions for the dual, which is an unconstrained convex problem. The term log(u) T 1n λn 1 n in the definition of α ⋆ λ is used to normalize α ⋆ λ so that it sums to zero as discussed in the end of §4.1.

Matrix Scaling Computation of (u, v)
The positive vectors (u, v) mentioned in Proposition 2 can be computed through Sinkhorn's matrix scaling algorithm applied to K, as outlined in Algorithm 3: Lemma 1 (Sinkhorn, 1967). For any positive matrix A in R n×m + and positive probability vectors a ∈ Σ n and b ∈ Σ m , there exist positive vectors u ∈ R n + and v ∈ R m + , unique up to scalar multiplication, such that diag(u)A diag(v) ∈ U (a, b). Such a pair (u, v) can be recovered as a fixed point of the Sinkhorn map The convergence of the algorithm is linear when using Hilbert's projective metric between the scaling factors (Franklin and Lorenz, 1989, §3). Although we use this algorithm in our experiments because of its simplicity, other algorithms exist (Knight and Ruiz, 2012) which are known to be more reliable numerically when λ is large. Summary: Given a smoothing parameter λ > 0, using Sinkhorn's algorithm on matrix K, defined as the elementwise exponential of −λM (the pairwise Gaussian kernel % use bsxfun(@times, v, (bsxfun(@times, K, u)) ′ ); matrix between the supports X and Y when p = 2, using bandwidth σ = 1/ √ 2λ) we can recover smoothed optima α ⋆ λ and T ⋆ λ for both smoothed primal p λ and dual d λ transport problems. To take advantage of this, we simply propose to substitute the smoothed optima α ⋆ λ and T ⋆ λ to the original optima α ⋆ and T ⋆ that appear in Algorithms 1 and 2.

Applications
We present two applications, one of Algorithm 1 and one of Algorithm 2, that both rely on the smooth approximations presented in §5. The settings we consider involve computing respectively tens of thousands or tens of high-dimensional optimal transport problems-2.500×2.500 for the first application, 57.647 × 48 for the second-which cannot be realistically carried out using network flow solvers. Using network flow solvers, the resolution of a single transport problem of these dimensions could take between several minutes to several hours. We also take advantage in the first application of the fact that Algorithm 3 can be run efficiently on GPGPUs using vectorized code (Cuturi, 2013, Alg.1).

Visualization of Perturbed Images
We use 50.000 images of the MNIST database, with approximately 5.000 images for each digit from 0 to 9. Each image (originally 20 × 20 pixels) is scaled randomly, uniformly between half-size and double-size, and translated randomly within a 50 × 50 grid, with a bias towards corners. We display intermediate barycenter solutions for each of these 10 datasets of images for t = 1, 10, 60 gradient iterations. λ is set to 60/median(M ), where M is the squared-Euclidean distance matrix between all 2,500 pixels in the grid. Using a Quadro K5000 GPU with close to 1500 cores, the computation of a single barycenter takes about 2 hours to reach 100 iterations. Because we use warm starts to initialize u in Algorithm 3 at each iteration of Algorithm 1, the first iterations are typically more computationally intensive than those carried out near the end.

Clustering with Uniform Centroids
In practice, the k-means cost function applied to a given empirical measure could be minimized with a set of centroids X and weight vector a such that the entropy of a is very small. This can occur when most of the original points in the dataset are attributed to a very small subset of the k centroids, and could be undesirable in applications of k-means where a more regular attribution is sought. For instance, in sensor deployment, when each centroid (sensor) is limited in the number of data points (users) it can serve, we would like to ensure that the attributions agree with those limits.
Whereas the original k-means cannot take into account such limits, we can ensure them using Algorithm 2. We illustrate the difference between looking for optimal centroids with "free" assignments (Θ = Σ k ), and looking for optimal "uniform" centroids with constrained assignments (Θ = {1 k /k}) using US census data for income and population repartitions across 57.647 spatial locations in the 48 contigu- Figure 3. Comparison of two Wasserstein barycenters on spatial repartitions of income and population in the 48 contiguous states, using as many (k = 48) centroids. The size of each of the 57.647 blue crosses is proportional to the local average of the relevant variable (income above and population below) at that location, normalized to sum to 1. Each downward triangle is a centroid of the k-means clustering (equivalent to a Wasserstein barycenter with Θ = Σ k ) whose size is proportional to the portion of mass captured by that centroid. Red dots indicate centroids obtained with a uniform constraint on the weights, Θ = {1 k /k}. Since such centroids are constrained to carry a fixed portion of the total weight, one can observe that they provide a more balanced clustering than the k-means solution.
ous states. These weighted points can be interpreted as two empirical measures on R 2 with weights directly proportional to these respective quantities. We initialize both "free" and "uniform" clustering with the actual 48 state capitals. Results displayed in Figure 3 show that by forcing our approximation to be uniform, we recover centroids that induce a more balanced clustering. Indeed, each cell of the Voronoi diagram built with these centroids is now constrained to hold the same aggregate wealth or population. These centroids could form the new state capitals of equally rich or equally populated states. On an algorithmic note, we notice in Figure 4 that Algorithm 2 converges to its (local) optimum at a speed which is directly comparable to that of the k-means in terms of iterations, with a relatively modest computational overhead. Unsurprisingly, the Wasserstein distance between the clusters and the original measure is higher when adding uniform constraints on the weights.  Figure 4. Wasserstein distance of the uniform Wasserstein barycenter (weights constrained to be in Θ = {1 k /k}) and its unconstrained equivalent (k-means) to the income empirical measure. Note that, because of the constraints on weights, the Wasserstein distance of the uniform Wasserstein barycenter is necessarily larger. On a single CPU core, these computations require 12.5 seconds for the constrained case, using Sinkhorn's approximation, and 1.55 seconds for the regular k-means algorithm. Using a regular transportation solver, computing the optimal transport from the 57.647 points to the 48 centroids would require about 1 hour for a single iteration Conclusion We have proposed in this paper two original algorithms to compute Wasserstein barycenters of empirical measures. Using these algorithms in practice for measures of large support is a daunting task for two reasons: they are inherently slow because they rely on the subgradient method; the computation of these subgradients involves solving optimal and dual optimal transport problems. Both issues can be substantially alleviated by smoothing the primal optimal transport problem with an entropic penalty and considering its dual. Both smoothed problems admit gradients which can be computed efficiently using only matrix vector products. Our aim in proposing such algorithms is to demonstrate that Wasserstein barycenters can be used for visualization, constrained clustering, and hopefully as a core component within more complex data analysis techniques in future applications. We also believe that our smoothing approach can be directly applied to more complex variational problems that involve multiple Wasserstein distances, such