Skip to content

Commit bc6534c

Browse files
committed
minor doc fixes + better gwb logo
1 parent 0328966 commit bc6534c

File tree

4 files changed

+36
-18
lines changed

4 files changed

+36
-18
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,6 @@ Dictionary Learning](https://arxiv.org/pdf/2102.06555.pdf), International Confer
290290

291291
[41] Chapel*, L., Flamary*, R., Wu, H., Févotte, C., Gasso, G. (2021). [Unbalanced Optimal Transport through Non-negative Penalized Linear Regression](https://proceedings.neurips.cc/paper/2021/file/c3c617a9b80b3ae1ebd868b0017cc349-Paper.pdf) Advances in Neural Information Processing Systems (NeurIPS), 2020. (Two first co-authors)
292292

293-
[42] DELON, Julie, GOZLAN, Nathael, et SAINT-DIZIER, Alexandre. [Generalized Wasserstein barycenters between probability measures living on different subspaces](https://arxiv.org/pdf/2105.09755). arXiv preprint arXiv:2105.09755, 2021.
293+
[42] Delon, J., Gozlan, N., and Saint-Dizier, A. [Generalized Wasserstein barycenters between probability measures living on different subspaces](https://arxiv.org/pdf/2105.09755). arXiv preprint arXiv:2105.09755, 2021.
294294

295295
[43] Álvarez-Esteban, Pedro C., et al. [A fixed-point approach to barycenters in Wasserstein space.](https://arxiv.org/pdf/1511.05355.pdf) Journal of Mathematical Analysis and Applications 441.2 (2016): 744-762.

examples/backends/plot_sliced_wass_grad_flow_pytorch.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@
103103

104104
# %%
105105
# Animate trajectories of the gradient flow along iteration
106-
# -------------------------------------------------------
106+
# ---------------------------------------------------------
107107

108108
pl.figure(3, (8, 4))
109109

@@ -122,7 +122,7 @@ def _update_plot(i):
122122

123123
# %%
124124
# Compute the Sliced Wasserstein Barycenter
125-
#
125+
# -----------------------------------------
126126
x1_torch = torch.tensor(x1).to(device=device)
127127
x3_torch = torch.tensor(x3).to(device=device)
128128
xbinit = np.random.randn(500, 2) * 10 + 16
@@ -169,7 +169,7 @@ def _update_plot(i):
169169

170170
# %%
171171
# Animate trajectories of the barycenter along gradient descent
172-
# -------------------------------------------------------
172+
# -------------------------------------------------------------
173173

174174
pl.figure(5, (8, 4))
175175

examples/barycenters/plot_generalized_free_support_barycenter.py

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
# -*- coding: utf-8 -*-
22
"""
33
=======================================
4-
Generalised Wasserstein Barycenter Demo
4+
Generalized Wasserstein Barycenter Demo
55
=======================================
66
7-
This example illustrates the computation of Generalised Wasserstein Barycenter
7+
This example illustrates the computation of Generalized Wasserstein Barycenter
88
as proposed in [42].
99
1010
11-
[42] DELON, Julie, GOZLAN, Nathael, et SAINT-DIZIER, Alexandre.
11+
[42] Delon, J., Gozlan, N., and Saint-Dizier, A..
1212
Generalized Wasserstein barycenters between probability measures living on different subspaces.
1313
arXiv preprint arXiv:2105.09755, 2021.
1414
@@ -26,9 +26,9 @@
2626
import ot
2727
import matplotlib.animation as animation
2828

29-
##############################################################################
29+
########################
3030
# Generate and plot data
31-
# -------------
31+
# ----------------------
3232

3333
# Input measures
3434
sub_sample_factor = 8
@@ -55,7 +55,7 @@
5555
weights = np.array([1 / 3, 1 / 3, 1 / 3])
5656

5757
# Number of barycenter points to compute
58-
n_samples_bary = 100
58+
n_samples_bary = 150
5959

6060
# Send the input measures into 3D space for visualisation
6161
X_visu = [Xi @ Pi for (Xi, Pi) in zip(X_list, P_list)]
@@ -71,10 +71,27 @@
7171
axis.set_zticks([])
7272
plt.show()
7373

74-
##############################################################################
74+
#################################
7575
# Barycenter computation and plot
76-
# ----------------------
76+
# -------------------------------
77+
7778
Y = ot.lp.generalized_free_support_barycenter(X_list, a_list, P_list, n_samples_bary)
79+
fig = plt.figure(figsize=(3, 3))
80+
81+
axis = fig.add_subplot(1, 1, 1, projection="3d")
82+
for Xi in X_visu:
83+
axis.scatter(Xi[:, 0], Xi[:, 1], Xi[:, 2], marker='o', alpha=.6)
84+
axis.scatter(Y[:, 0], Y[:, 1], Y[:, 2], marker='o', alpha=.6)
85+
axis.view_init(azim=45)
86+
axis.set_xticks([])
87+
axis.set_yticks([])
88+
axis.set_zticks([])
89+
plt.show()
90+
91+
92+
#############################
93+
# Plotting projection matches
94+
# ---------------------------
7895

7996
fig = plt.figure(figsize=(9, 3))
8097

ot/lp/__init__.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -623,7 +623,7 @@ def free_support_barycenter(measures_locations, measures_weights, X_init, b=None
623623
----------
624624
.. [20] Cuturi, Marco, and Arnaud Doucet. "Fast computation of Wasserstein barycenters." International Conference on Machine Learning. 2014.
625625
626-
.. [43] Álvarez-Esteban, Pedro C., et al. "A fixed-point approach to barycenters in Wasserstein space." Journal of Mathematical Analysis and Applications 441.2 (2016): 744-762.
626+
.. [43] Álvarez-Esteban, Pedro C., et al. "A fixed-point approach to barycenters in Wasserstein space." Journal of Mathematical Analysis and Applications 441.2 (2016): 744-762.
627627
628628
"""
629629

@@ -693,8 +693,9 @@ def generalized_free_support_barycenter(X_list, a_list, P_list, n_samples_bary,
693693
- :math:`w = (w_1, \cdots w_p)` are the barycenter coefficients (on the simplex)
694694
- Each :math:`\mathbf{P}_i \in \mathbb{R}^{d, d_i}`, and :math:`P_i\#\nu_i = \sum_{j=1}^{k_i}a_{i,j}\delta_{P_ix_{i,j}}`
695695
696-
As show by :ref:`[42]`, this problem can be re-written as a Wasserstein Barycenter problem,
697-
which we solve using the free support method :ref:`[20] <references-generalised-free-support-barycenter>`
696+
As show by :ref:`[42] <references-generalized-free-support-barycenter>`,
697+
this problem can be re-written as a Wasserstein Barycenter problem,
698+
which we solve using the free support method :ref:`[20] <references-generalized-free-support-barycenter>`
698699
(Algorithm 2).
699700
700701
Parameters
@@ -736,12 +737,12 @@ def generalized_free_support_barycenter(X_list, a_list, P_list, n_samples_bary,
736737
Support locations (on n_samples_bary atoms) of the barycenter
737738
738739
739-
.. _references-generalised-free-support-barycenter:
740+
.. _references-generalized-free-support-barycenter:
740741
References
741742
----------
742-
.. [20] Cuturi, Marco, and Arnaud Doucet. "Fast computation of Wasserstein barycenters." International Conference on Machine Learning. 2014.
743+
.. [20] Cuturi, M. and Doucet, A.. "Fast computation of Wasserstein barycenters." International Conference on Machine Learning. 2014.
743744
744-
.. [42] DELON, Julie, GOZLAN, Nathael, et SAINT-DIZIER, Alexandre. Generalized Wasserstein barycenters between probability measures living on different subspaces. arXiv preprint arXiv:2105.09755, 2021.
745+
.. [42] Delon, J., Gozlan, N., and Saint-Dizier, A.. Generalized Wasserstein barycenters between probability measures living on different subspaces. arXiv preprint arXiv:2105.09755, 2021.
745746
746747
"""
747748
nx = get_backend(*X_list, *a_list, *P_list)

0 commit comments

Comments
 (0)