Skip to content

Commit 2aeb591

Browse files
kachayevrflamary
andauthored
[DOC] Corrected spelling errors (#467)
* Fix typos in docstrings and examples * A few more fixes * Fix ref for `center_ot_dual` function * Another typo * Fix titles formatting * Explicit empty line after math blocks * Typo: asymmetric * Fix code cell formatting for 1D barycenters * Empirical * Fix indentation for references * Fixed all WARNINGs about title formatting * Fix empty lines after math blocks * Fix whitespace line * Update changelog * Consistent Gromov-Wasserstein * More Gromov-Wasserstein consistency --------- Co-authored-by: Rémi Flamary <remi.flamary@gmail.com>
1 parent 8a7035b commit 2aeb591

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+232
-209
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ You can also post bug reports and feature requests in Github issues. Make sure t
212212

213213
[3] Benamou, J. D., Carlier, G., Cuturi, M., Nenna, L., & Peyré, G. (2015). [Iterative Bregman projections for regularized transportation problems](https://arxiv.org/pdf/1412.5154.pdf). SIAM Journal on Scientific Computing, 37(2), A1111-A1138.
214214

215-
[4] S. Nakhostin, N. Courty, R. Flamary, D. Tuia, T. Corpetti, [Supervised planetary unmixing with optimal transport](https://hal.archives-ouvertes.fr/hal-01377236/document), Whorkshop on Hyperspectral Image and Signal Processing : Evolution in Remote Sensing (WHISPERS), 2016.
215+
[4] S. Nakhostin, N. Courty, R. Flamary, D. Tuia, T. Corpetti, [Supervised planetary unmixing with optimal transport](https://hal.archives-ouvertes.fr/hal-01377236/document), Workshop on Hyperspectral Image and Signal Processing : Evolution in Remote Sensing (WHISPERS), 2016.
216216

217217
[5] N. Courty; R. Flamary; D. Tuia; A. Rakotomamonjy, [Optimal Transport for Domain Adaptation](https://arxiv.org/pdf/1507.00504.pdf), in IEEE Transactions on Pattern Analysis and Machine Intelligence , vol.PP, no.99, pp.1-1
218218

@@ -250,7 +250,7 @@ You can also post bug reports and feature requests in Github issues. Make sure t
250250

251251
[22] J. Altschuler, J.Weed, P. Rigollet, (2017) [Near-linear time approximation algorithms for optimal transport via Sinkhorn iteration](https://papers.nips.cc/paper/6792-near-linear-time-approximation-algorithms-for-optimal-transport-via-sinkhorn-iteration.pdf), Advances in Neural Information Processing Systems (NIPS) 31
252252

253-
[23] Aude, G., Peyré, G., Cuturi, M., [Learning Generative Models with Sinkhorn Divergences](https://arxiv.org/abs/1706.00292), Proceedings of the Twenty-First International Conference on Artficial Intelligence and Statistics, (AISTATS) 21, 2018
253+
[23] Aude, G., Peyré, G., Cuturi, M., [Learning Generative Models with Sinkhorn Divergences](https://arxiv.org/abs/1706.00292), Proceedings of the Twenty-First International Conference on Artificial Intelligence and Statistics, (AISTATS) 21, 2018
254254

255255
[24] Vayer, T., Chapel, L., Flamary, R., Tavenard, R. and Courty, N. (2019). [Optimal Transport for structured data with application on graphs](http://proceedings.mlr.press/v97/titouan19a.html) Proceedings of the 36th International Conference on Machine Learning (ICML).
256256

RELEASES.md

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99

1010
- Fix circleci-redirector action and codecov (PR #460)
1111
- Fix issues with cuda for ot.binary_search_circle and with gradients for ot.sliced_wasserstein_sphere (PR #457)
12+
- Major documentation cleanup (PR #462, #467)
13+
- Fix gradients for "Wasserstein2 Minibatch GAN" example (PR #466)
1214

1315
## 0.9.0
1416

@@ -87,7 +89,7 @@ big. More details below.
8789

8890

8991
#### New features
90-
- Added feature to (Fused) Gromov-Wasserstein solvers herited from `ot.optim` to support relative and absolute loss variations as stopping criterions (PR #431)
92+
- Added feature to (Fused) Gromov-Wasserstein solvers inherited from `ot.optim` to support relative and absolute loss variations as stopping criterions (PR #431)
9193
- Added feature to (Fused) Gromov-Wasserstein solvers to handle asymmetric matrices (PR #431)
9294
- Added semi-relaxed (Fused) Gromov-Wasserstein solvers in `ot.gromov` + examples (PR #431)
9395
- Added the spherical sliced-Wasserstein discrepancy in `ot.sliced.sliced_wasserstein_sphere` and `ot.sliced.sliced_wasserstein_sphere_unif` + examples (PR #434)
@@ -279,7 +281,7 @@ a [Generative Network
279281
(GAN)](https://PythonOT.github.io/auto_examples/backends/plot_wass2_gan_torch.html),
280282
for a [sliced Wasserstein gradient
281283
flow](https://PythonOT.github.io/auto_examples/backends/plot_sliced_wass_grad_flow_pytorch.html)
282-
and [optimizing the Gromov-Wassersein distance](https://PythonOT.github.io/auto_examples/backends/plot_optim_gromov_pytorch.html). Note that the Jax backend is still in early development and quite
284+
and [optimizing the Gromov-Wasserstein distance](https://PythonOT.github.io/auto_examples/backends/plot_optim_gromov_pytorch.html). Note that the Jax backend is still in early development and quite
283285
slow at the moment, we strongly recommend for Jax users to use the [OTT
284286
toolbox](https://github.com/google-research/ott) when possible.
285287
As a result of this new feature,
@@ -291,7 +293,7 @@ Pointwise Gromov
291293
Wasserstein](https://PythonOT.github.io/auto_examples/gromov/plot_gromov.html#compute-gw-with-a-scalable-stochastic-method-with-any-loss-function),
292294
Sinkhorn in log space with `method='sinkhorn_log'`, [Projection Robust
293295
Wasserstein](https://PythonOT.github.io/gen_modules/ot.dr.html?highlight=robust#ot.dr.projection_robust_wasserstein),
294-
ans [deviased Sinkorn barycenters](https://PythonOT.github.ioauto_examples/barycenters/plot_debiased_barycenter.html).
296+
ans [debiased Sinkhorn barycenters](https://PythonOT.github.ioauto_examples/barycenters/plot_debiased_barycenter.html).
295297

296298
This release will also simplify the installation process. We have now a
297299
`pyproject.toml` that defines the build dependency and POT should now build even
@@ -432,15 +434,15 @@ are coming for the next versions.
432434

433435
#### Closed issues
434436

435-
- Add JMLR paper to the readme and Mathieu Blondel to the Acknoledgments (PR
437+
- Add JMLR paper to the readme and Mathieu Blondel to the Acknowledgments (PR
436438
#231, #232)
437439
- Bug in Unbalanced OT example (Issue #127)
438440
- Clean Cython output when calling setup.py clean (Issue #122)
439441
- Various Macosx compilation problems (Issue #113, Issue #118, PR#130)
440442
- EMD dimension mismatch (Issue #114, Fixed in PR #116)
441443
- 2D barycenter bug for non square images (Issue #124, fixed in PR #132)
442444
- Bad value in EMD 1D (Issue #138, fixed in PR #139)
443-
- Log bugs for Gromov-Wassertein solver (Issue #107, fixed in PR #108)
445+
- Log bugs for Gromov-Wasserstein solver (Issue #107, fixed in PR #108)
444446
- Weight issues in barycenter function (PR #106)
445447

446448
## 0.6.0
@@ -471,9 +473,9 @@ a solver for [Unbalanced OT
471473
barycenters](https://github.com/rflamary/POT/blob/master/notebooks/plot_UOT_barycenter_1D.ipynb).
472474
A new variant of Gromov-Wasserstein divergence called [Fused
473475
Gromov-Wasserstein](https://pot.readthedocs.io/en/latest/all.html?highlight=fused_#ot.gromov.fused_gromov_wasserstein)
474-
has been also contributed with exemples of use on [structured
476+
has been also contributed with examples of use on [structured
475477
data](https://github.com/rflamary/POT/blob/master/notebooks/plot_fgw.ipynb) and
476-
computing [barycenters of labeld
478+
computing [barycenters of labeled
477479
graphs](https://github.com/rflamary/POT/blob/master/notebooks/plot_barycenter_fgw.ipynb).
478480

479481

@@ -534,7 +536,7 @@ and [free support](https://github.com/rflamary/POT/blob/master/notebooks/plot_fr
534536
implementation of entropic OT.
535537

536538
POT 0.5 also comes with a rewriting of ot.gpu using the cupy framework instead of
537-
the unmaintained cudamat. Note that while we tried to keed changes to the
539+
the unmaintained cudamat. Note that while we tried to keep changes to the
538540
minimum, the OTDA classes were deprecated. If you are happy with the cudamat
539541
implementation, we recommend you stay with stable release 0.4 for now.
540542

@@ -558,7 +560,7 @@ and new POT contributors (you can see the list in the [readme](https://github.co
558560
* Stochastic OT in the dual and semi-dual (PR #52 and PR #62)
559561
* Free support barycenters (PR #56)
560562
* Speed-up Sinkhorn function (PR #57 and PR #58)
561-
* Add convolutional Wassersein barycenters for 2D images (PR #64)
563+
* Add convolutional Wasserstein barycenters for 2D images (PR #64)
562564
* Add Greedy Sinkhorn variant (Greenkhorn) (PR #66)
563565
* Big ot.gpu update with cupy implementation (instead of un-maintained cudamat) (PR #67)
564566

@@ -609,15 +611,15 @@ This release contains a lot of contribution from new contributors.
609611
* new notebooks for emd computation and Wasserstein Discriminant Analysis
610612
* relocate notebooks
611613
* update documentation
612-
* clean_zeros(a,b,M) for removimg zeros in sparse distributions
614+
* clean_zeros(a,b,M) for removing zeros in sparse distributions
613615
* GPU implementations for sinkhorn and group lasso regularization
614616

615617

616618
## V0.2
617619
*7 Apr 2017*
618620

619621
* New dimensionality reduction method (WDA)
620-
* Efficient method emd2 returns only tarnsport (in paralell if several histograms given)
622+
* Efficient method emd2 returns only transport (in parallel if several histograms given)
621623

622624

623625

docs/source/quickstart.rst

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ case you are only solving an approximation of the Wasserstein distance because
151151
the 1-Lipschitz constraint on the dual cannot be enforced exactly (approximated
152152
through filter thresholding or regularization). Finally note that in order to
153153
avoid solving large scale OT problems, a number of recent approached minimized
154-
the expected Wasserstein distance on minibtaches that is different from the
154+
the expected Wasserstein distance on minibatches that is different from the
155155
Wasserstein but has better computational and
156156
`statistical properties <https://arxiv.org/pdf/1910.04091.pdf>`_.
157157

@@ -164,8 +164,8 @@ Optimal transport and Wasserstein distance
164164
In POT, most functions that solve OT or regularized OT problems have two
165165
versions that return the OT matrix or the value of the optimal solution. For
166166
instance :any:`ot.emd` returns the OT matrix and :any:`ot.emd2` returns the
167-
Wassertsein distance. This approach has been implemented in practice for all
168-
solvers that return an OT matrix (even Gromov-Wasserstsein).
167+
Wasserstein distance. This approach has been implemented in practice for all
168+
solvers that return an OT matrix (even Gromov-Wasserstein).
169169

170170
.. _kantorovitch_solve:
171171

@@ -349,9 +349,9 @@ More details about the algorithms used are given in the following note.
349349
classic algorithm [2]_.
350350
+ :code:`method='sinkhorn_log'` calls :any:`ot.bregman.sinkhorn_log` the
351351
sinkhorn algorithm in log space [2]_ that is more stable but can be
352-
slower in numpy since `logsumexp` is not implmemented in parallel.
352+
slower in numpy since `logsumexp` is not implemented in parallel.
353353
It is the recommended solver for applications that requires
354-
differentiability with a small number of iterations.
354+
differentiability with a small number of iterations.
355355
+ :code:`method='sinkhorn_stabilized'` calls :any:`ot.bregman.sinkhorn_stabilized` the
356356
log stabilized version of the algorithm [9]_.
357357
+ :code:`method='sinkhorn_epsilon_scaling'` calls
@@ -368,7 +368,7 @@ More details about the algorithms used are given in the following note.
368368
function to solve the smooth problem with :code:`L-BFGS-B` algorithm. Tu use
369369
this solver, use functions :any:`ot.smooth.smooth_ot_dual` or
370370
:any:`ot.smooth.smooth_ot_semi_dual` with parameter :code:`reg_type='kl'` to
371-
choose entropic/Kullbach Leibler regularization.
371+
choose entropic/Kullbach-Leibler regularization.
372372

373373
**Choosing a Sinkhorn solver**
374374

@@ -378,7 +378,7 @@ More details about the algorithms used are given in the following note.
378378
:any:`ot.bregman.sinkhorn_stabilized` solver that will avoid numerical
379379
errors. This last solver can be very slow in practice and might not even
380380
converge to a reasonable OT matrix in a finite time. This is why
381-
:any:`ot.bregman.sinkhorn_epsilon_scaling` that relie on iterating the value
381+
:any:`ot.bregman.sinkhorn_epsilon_scaling` that relies on iterating the value
382382
of the regularization (and using warm start) sometimes leads to better
383383
solutions. Note that the greedy version of the Sinkhorn
384384
:any:`ot.bregman.greenkhorn` can also lead to a speedup and the screening
@@ -546,7 +546,7 @@ where :math:`b_k` are also weights in the simplex. In the non-regularized case,
546546
the problem above is a classical linear program. In this case we propose a
547547
solver :meth:`ot.lp.barycenter` that relies on generic LP solvers. By default the
548548
function uses :any:`scipy.optimize.linprog`, but more efficient LP solvers from
549-
cvxopt can be also used by changing parameter :code:`solver`. Note that this problem
549+
`cvxopt` can be also used by changing parameter :code:`solver`. Note that this problem
550550
requires to solve a very large linear program and can be very slow in
551551
practice.
552552

@@ -812,7 +812,7 @@ Gromov Wasserstein(GW)
812812
Gromov Wasserstein (GW) is a generalization of OT to distributions that do not lie in
813813
the same space [13]_. In this case one cannot compute distance between samples
814814
from the two distributions. [13]_ proposed instead to realign the metric spaces
815-
by computing a transport between distance matrices. The Gromow Wasserstein
815+
by computing a transport between distance matrices. The Gromov Wasserstein
816816
alignment between two distributions can be expressed as the one minimizing:
817817

818818
.. math::
@@ -837,7 +837,7 @@ There also exists an entropic regularized variant of GW that has been proposed i
837837
:heading-level: "
838838

839839
Gromov Wasserstein barycenters
840-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
840+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
841841

842842
Note that similarly to Wasserstein distance GW allows for the definition of GW
843843
barycenters that can be expressed as
@@ -1134,7 +1134,7 @@ References
11341134
11351135
.. [23] Genevay, A., Peyré, G., Cuturi, M., `Learning Generative Models with
11361136
Sinkhorn Divergences <https://arxiv.org/abs/1706.00292>`__, Proceedings
1137-
of the Twenty-First International Conference on Artficial Intelligence
1137+
of the Twenty-First International Conference on Artificial Intelligence
11381138
and Statistics, (AISTATS) 21, 2018
11391139
11401140
.. [24] Vayer, T., Chapel, L., Flamary, R., Tavenard, R. and Courty, N.
@@ -1187,18 +1187,18 @@ References
11871187
In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (pp. 10648-10656).
11881188
11891189
.. [36] Liutkus, A., Simsekli, U., Majewski, S., Durmus, A., & Stöter, F. R.
1190-
(2019, May). `Sliced-Wasserstein flows: Nonparametric generative modeling via
1191-
optimal transport and diffusions
1192-
<http://proceedings.mlr.press/v97/liutkus19a/liutkus19a.pdf>`_. In International
1193-
Conference on Machine Learning (pp. 4104-4113). PMLR.
1190+
(2019, May). `Sliced-Wasserstein flows: Nonparametric generative modeling via
1191+
optimal transport and diffusions
1192+
<http://proceedings.mlr.press/v97/liutkus19a/liutkus19a.pdf>`_. In International
1193+
Conference on Machine Learning (pp. 4104-4113). PMLR.
11941194
11951195
.. [37] Janati, H., Cuturi, M., Gramfort, A. `Debiased sinkhorn barycenters
11961196
<http://proceedings.mlr.press/v119/janati20a/janati20a.pdf>`_ Proceedings of
11971197
the 37th International Conference on Machine Learning, PMLR 119:4692-4701, 2020
11981198
11991199
.. [38] C. Vincent-Cuaz, T. Vayer, R. Flamary, M. Corneli, N. Courty, `Online
1200-
Graph Dictionary Learning <https://arxiv.org/pdf/2102.06555.pdf>`_\ ,
1201-
International Conference on Machine Learning (ICML), 2021.
1200+
Graph Dictionary Learning <https://arxiv.org/pdf/2102.06555.pdf>`_\ ,
1201+
International Conference on Machine Learning (ICML), 2021.
12021202
12031203
.. [39] Gozlan, N., Roberto, C., Samson, P. M., & Tetali, P. (2017).
12041204
`Kantorovich duality for general transport costs and applications

examples/backends/plot_dual_ot_pytorch.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@
100100
Ge = ot.stochastic.plan_dual_entropic(u, v, xs, xt, reg=reg)
101101

102102
# %%
103-
# Plot teh estimated entropic OT plan
103+
# Plot the estimated entropic OT plan
104104
# -----------------------------------
105105

106106
pl.figure(3, (10, 5))
@@ -114,7 +114,7 @@
114114

115115
# %%
116116
# Estimating dual variables for quadratic OT
117-
# -----------------------------------------
117+
# ------------------------------------------
118118

119119
u = torch.randn(n_source_samples, requires_grad=True)
120120
v = torch.randn(n_source_samples, requires_grad=True)
@@ -157,7 +157,7 @@
157157

158158
# %%
159159
# Plot the estimated quadratic OT plan
160-
# -----------------------------------
160+
# ------------------------------------
161161

162162
pl.figure(5, (10, 5))
163163
pl.clf()

examples/backends/plot_optim_gromov_pytorch.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
r"""
2-
=================================
2+
=======================================================
33
Optimizing the Gromov-Wasserstein distance with PyTorch
4-
=================================
4+
=======================================================
55
66
In this example, we use the pytorch backend to optimize the Gromov-Wasserstein
77
(GW) loss between two graphs expressed as empirical distribution.
@@ -11,7 +11,7 @@
1111
We can see that this actually recovers the proportion of classes in the SBM
1212
and allows for an accurate clustering of the nodes using the GW optimal plan.
1313
14-
In the second part, we optimize simultaneously the weights and the sructure of
14+
In the second part, we optimize simultaneously the weights and the structure of
1515
the template graph which allows us to perform graph compression and to recover
1616
other properties of the SBM.
1717
@@ -38,7 +38,7 @@
3838

3939
# %%
4040
# Graph generation
41-
# ---------------
41+
# ----------------
4242

4343
rng = np.random.RandomState(42)
4444

@@ -95,8 +95,8 @@ def plot_graph(x, C, color='C0', s=None):
9595

9696
# %%
9797
# Optimizing GW w.r.t. the weights on a template structure
98-
# ------------------------------------------------
99-
# The adajacency matrix C1 is block diagonal with 3 blocks. We want to
98+
# --------------------------------------------------------
99+
# The adjacency matrix C1 is block diagonal with 3 blocks. We want to
100100
# optimize the weights of a simple template C0=eye(3) and see if we can
101101
# recover the proportion of classes from the SBM (up to a permutation).
102102

@@ -155,7 +155,7 @@ def min_weight_gw(C1, C2, a2, nb_iter_max=100, lr=1e-2):
155155

156156
# %%
157157
# Community clustering with uniform and estimated weights
158-
# --------------------------------------------
158+
# -------------------------------------------------------
159159
# The GW OT plan can be used to perform a clustering of the nodes of a graph
160160
# when computing the GW with a simple template like C0 by labeling nodes in
161161
# the original graph using by the index of the noe in the template receiving
@@ -193,7 +193,7 @@ def min_weight_gw(C1, C2, a2, nb_iter_max=100, lr=1e-2):
193193
# classes
194194

195195

196-
def graph_compession_gw(nb_nodes, C2, a2, nb_iter_max=100, lr=1e-2):
196+
def graph_compression_gw(nb_nodes, C2, a2, nb_iter_max=100, lr=1e-2):
197197
""" solve min_a GW(C1,C2,a, a2) by gradient descent"""
198198

199199
# use pyTorch for our data
@@ -237,8 +237,8 @@ def graph_compession_gw(nb_nodes, C2, a2, nb_iter_max=100, lr=1e-2):
237237

238238

239239
nb_nodes = 3
240-
a0_est2, C0_est2, loss_iter2 = graph_compession_gw(nb_nodes, C1, ot.unif(n),
241-
nb_iter_max=100, lr=5e-2)
240+
a0_est2, C0_est2, loss_iter2 = graph_compression_gw(nb_nodes, C1, ot.unif(n),
241+
nb_iter_max=100, lr=5e-2)
242242

243243
pl.figure(4)
244244
pl.plot(loss_iter2)

examples/backends/plot_sliced_wass_grad_flow_pytorch.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
r"""
2-
=================================
2+
============================================================
33
Sliced Wasserstein barycenter and gradient flow with PyTorch
4-
=================================
4+
============================================================
55
6-
In this exemple we use the pytorch backend to optimize the sliced Wasserstein
6+
In this example we use the pytorch backend to optimize the sliced Wasserstein
77
loss between two empirical distributions [31].
88
99
In the first example one we perform a
1010
gradient flow on the support of a distribution that minimize the sliced
11-
Wassersein distance as poposed in [36].
11+
Wasserstein distance as proposed in [36].
1212
13-
In the second exemple we optimize with a gradient descent the sliced
13+
In the second example we optimize with a gradient descent the sliced
1414
Wasserstein barycenter between two distributions as in [31].
1515
1616
[31] Bonneel, Nicolas, et al. "Sliced and radon wasserstein barycenters of

examples/backends/plot_ssw_unif_torch.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ def plot_sphere(ax):
119119

120120
# %%
121121
# Animate trajectories of generated samples along iteration
122-
# -------------------------------------------------------
122+
# ---------------------------------------------------------
123123

124124
pl.figure(4, (8, 8))
125125

0 commit comments

Comments
 (0)