summaryrefslogtreecommitdiff
path: root/examples/backends
diff options
context:
space:
mode:
Diffstat (limited to 'examples/backends')
-rw-r--r--examples/backends/plot_dual_ot_pytorch.py6
-rw-r--r--examples/backends/plot_optim_gromov_pytorch.py20
-rw-r--r--examples/backends/plot_sliced_wass_grad_flow_pytorch.py10
-rw-r--r--examples/backends/plot_ssw_unif_torch.py2
-rw-r--r--examples/backends/plot_stoch_continuous_ot_pytorch.py10
-rw-r--r--examples/backends/plot_unmix_optim_torch.py6
-rw-r--r--examples/backends/plot_wass1d_torch.py2
-rw-r--r--examples/backends/plot_wass2_gan_torch.py6
8 files changed, 31 insertions, 31 deletions
diff --git a/examples/backends/plot_dual_ot_pytorch.py b/examples/backends/plot_dual_ot_pytorch.py
index d3f7a66..67c7077 100644
--- a/examples/backends/plot_dual_ot_pytorch.py
+++ b/examples/backends/plot_dual_ot_pytorch.py
@@ -100,7 +100,7 @@ pl.xlabel("Iterations")
Ge = ot.stochastic.plan_dual_entropic(u, v, xs, xt, reg=reg)
# %%
-# Plot teh estimated entropic OT plan
+# Plot the estimated entropic OT plan
# -----------------------------------
pl.figure(3, (10, 5))
@@ -114,7 +114,7 @@ pl.title('Source and target distributions')
# %%
# Estimating dual variables for quadratic OT
-# -----------------------------------------
+# ------------------------------------------
u = torch.randn(n_source_samples, requires_grad=True)
v = torch.randn(n_source_samples, requires_grad=True)
@@ -157,7 +157,7 @@ Gq = ot.stochastic.plan_dual_quadratic(u, v, xs, xt, reg=reg)
# %%
# Plot the estimated quadratic OT plan
-# -----------------------------------
+# ------------------------------------
pl.figure(5, (10, 5))
pl.clf()
diff --git a/examples/backends/plot_optim_gromov_pytorch.py b/examples/backends/plot_optim_gromov_pytorch.py
index cdc1587..0ae2890 100644
--- a/examples/backends/plot_optim_gromov_pytorch.py
+++ b/examples/backends/plot_optim_gromov_pytorch.py
@@ -1,7 +1,7 @@
r"""
-=================================
+=======================================================
Optimizing the Gromov-Wasserstein distance with PyTorch
-=================================
+=======================================================
In this example, we use the pytorch backend to optimize the Gromov-Wasserstein
(GW) loss between two graphs expressed as empirical distribution.
@@ -11,7 +11,7 @@ graph so that it minimizes the GW with a given Stochastic Block Model graph.
We can see that this actually recovers the proportion of classes in the SBM
and allows for an accurate clustering of the nodes using the GW optimal plan.
-In the second part, we optimize simultaneously the weights and the sructure of
+In the second part, we optimize simultaneously the weights and the structure of
the template graph which allows us to perform graph compression and to recover
other properties of the SBM.
@@ -38,7 +38,7 @@ from ot.gromov import gromov_wasserstein2
# %%
# Graph generation
-# ---------------
+# ----------------
rng = np.random.RandomState(42)
@@ -95,8 +95,8 @@ pl.axis("off")
# %%
# Optimizing GW w.r.t. the weights on a template structure
-# ------------------------------------------------
-# The adajacency matrix C1 is block diagonal with 3 blocks. We want to
+# --------------------------------------------------------
+# The adjacency matrix C1 is block diagonal with 3 blocks. We want to
# optimize the weights of a simple template C0=eye(3) and see if we can
# recover the proportion of classes from the SBM (up to a permutation).
@@ -155,7 +155,7 @@ print("True proportions : ", ratio)
# %%
# Community clustering with uniform and estimated weights
-# --------------------------------------------
+# -------------------------------------------------------
# The GW OT plan can be used to perform a clustering of the nodes of a graph
# when computing the GW with a simple template like C0 by labeling nodes in
# the original graph using by the index of the noe in the template receiving
@@ -193,7 +193,7 @@ pl.axis("off")
# classes
-def graph_compession_gw(nb_nodes, C2, a2, nb_iter_max=100, lr=1e-2):
+def graph_compression_gw(nb_nodes, C2, a2, nb_iter_max=100, lr=1e-2):
""" solve min_a GW(C1,C2,a, a2) by gradient descent"""
# use pyTorch for our data
@@ -237,8 +237,8 @@ def graph_compession_gw(nb_nodes, C2, a2, nb_iter_max=100, lr=1e-2):
nb_nodes = 3
-a0_est2, C0_est2, loss_iter2 = graph_compession_gw(nb_nodes, C1, ot.unif(n),
- nb_iter_max=100, lr=5e-2)
+a0_est2, C0_est2, loss_iter2 = graph_compression_gw(nb_nodes, C1, ot.unif(n),
+ nb_iter_max=100, lr=5e-2)
pl.figure(4)
pl.plot(loss_iter2)
diff --git a/examples/backends/plot_sliced_wass_grad_flow_pytorch.py b/examples/backends/plot_sliced_wass_grad_flow_pytorch.py
index f00de50..07a4926 100644
--- a/examples/backends/plot_sliced_wass_grad_flow_pytorch.py
+++ b/examples/backends/plot_sliced_wass_grad_flow_pytorch.py
@@ -1,16 +1,16 @@
r"""
-=================================
+============================================================
Sliced Wasserstein barycenter and gradient flow with PyTorch
-=================================
+============================================================
-In this exemple we use the pytorch backend to optimize the sliced Wasserstein
+In this example we use the pytorch backend to optimize the sliced Wasserstein
loss between two empirical distributions [31].
In the first example one we perform a
gradient flow on the support of a distribution that minimize the sliced
-Wassersein distance as poposed in [36].
+Wasserstein distance as proposed in [36].
-In the second exemple we optimize with a gradient descent the sliced
+In the second example we optimize with a gradient descent the sliced
Wasserstein barycenter between two distributions as in [31].
[31] Bonneel, Nicolas, et al. "Sliced and radon wasserstein barycenters of
diff --git a/examples/backends/plot_ssw_unif_torch.py b/examples/backends/plot_ssw_unif_torch.py
index 7ccc2af..afe3fa6 100644
--- a/examples/backends/plot_ssw_unif_torch.py
+++ b/examples/backends/plot_ssw_unif_torch.py
@@ -119,7 +119,7 @@ for i in range(9):
# %%
# Animate trajectories of generated samples along iteration
-# -------------------------------------------------------
+# ---------------------------------------------------------
pl.figure(4, (8, 8))
diff --git a/examples/backends/plot_stoch_continuous_ot_pytorch.py b/examples/backends/plot_stoch_continuous_ot_pytorch.py
index 6d9b916..714a5d3 100644
--- a/examples/backends/plot_stoch_continuous_ot_pytorch.py
+++ b/examples/backends/plot_stoch_continuous_ot_pytorch.py
@@ -125,8 +125,8 @@ pl.xlabel("Iterations")
# %%
-# Plot the density on arget for a given source sample
-# ---------------------------------------------------
+# Plot the density on target for a given source sample
+# ----------------------------------------------------
nv = 100
@@ -155,7 +155,7 @@ Gg = Gg.reshape((nv, nv)).detach().numpy()
pl.scatter(Xs[:nvisu, 0], Xs[:nvisu, 1], marker='+', zorder=2, alpha=0.05)
pl.scatter(Xt[:nvisu, 0], Xt[:nvisu, 1], marker='o', zorder=2, alpha=0.05)
pl.scatter(Xs[iv:iv + 1, 0], Xs[iv:iv + 1, 1], s=100, marker='+', label='Source sample', zorder=2, alpha=1, color='C0')
-pl.pcolormesh(XX, YY, Gg, cmap='Greens', label='Density of transported sourec sample')
+pl.pcolormesh(XX, YY, Gg, cmap='Greens', label='Density of transported source sample')
pl.legend(loc=0)
ax_bounds = pl.axis()
pl.title('Density of transported source sample')
@@ -169,7 +169,7 @@ Gg = Gg.reshape((nv, nv)).detach().numpy()
pl.scatter(Xs[:nvisu, 0], Xs[:nvisu, 1], marker='+', zorder=2, alpha=0.05)
pl.scatter(Xt[:nvisu, 0], Xt[:nvisu, 1], marker='o', zorder=2, alpha=0.05)
pl.scatter(Xs[iv:iv + 1, 0], Xs[iv:iv + 1, 1], s=100, marker='+', label='Source sample', zorder=2, alpha=1, color='C0')
-pl.pcolormesh(XX, YY, Gg, cmap='Greens', label='Density of transported sourec sample')
+pl.pcolormesh(XX, YY, Gg, cmap='Greens', label='Density of transported source sample')
pl.legend(loc=0)
ax_bounds = pl.axis()
pl.title('Density of transported source sample')
@@ -183,7 +183,7 @@ Gg = Gg.reshape((nv, nv)).detach().numpy()
pl.scatter(Xs[:nvisu, 0], Xs[:nvisu, 1], marker='+', zorder=2, alpha=0.05)
pl.scatter(Xt[:nvisu, 0], Xt[:nvisu, 1], marker='o', zorder=2, alpha=0.05)
pl.scatter(Xs[iv:iv + 1, 0], Xs[iv:iv + 1, 1], s=100, marker='+', label='Source sample', zorder=2, alpha=1, color='C0')
-pl.pcolormesh(XX, YY, Gg, cmap='Greens', label='Density of transported sourec sample')
+pl.pcolormesh(XX, YY, Gg, cmap='Greens', label='Density of transported source sample')
pl.legend(loc=0)
ax_bounds = pl.axis()
pl.title('Density of transported source sample')
diff --git a/examples/backends/plot_unmix_optim_torch.py b/examples/backends/plot_unmix_optim_torch.py
index 9ae66e9..e47a5e0 100644
--- a/examples/backends/plot_unmix_optim_torch.py
+++ b/examples/backends/plot_unmix_optim_torch.py
@@ -135,7 +135,7 @@ for i in range(niter):
##############################################################################
# Estimated weights and convergence of the objective
-# ---------------------------------------------------
+# --------------------------------------------------
we = w.detach().numpy()
print('Estimated mixture:', we)
@@ -147,8 +147,8 @@ pl.title('Wasserstein distance')
pl.xlabel("Iterations")
##############################################################################
-# Ploting the reweighted source distribution
-# ------------------------------------------
+# Plotting the reweighted source distribution
+# -------------------------------------------
pl.figure(3)
diff --git a/examples/backends/plot_wass1d_torch.py b/examples/backends/plot_wass1d_torch.py
index cd8e2fd..5a85795 100644
--- a/examples/backends/plot_wass1d_torch.py
+++ b/examples/backends/plot_wass1d_torch.py
@@ -94,7 +94,7 @@ pl.show()
# %%
# Wasserstein barycenter
-# ---------
+# ----------------------
# In this example, we consider the following Wasserstein barycenter problem
# $$ \\eta^* = \\min_\\eta\;\;\; (1-t)W(\\mu,\\eta) + tW(\\eta,\\nu)$$
# where :math:`\\mu` and :math:`\\nu` are reference 1D measures, and :math:`t`
diff --git a/examples/backends/plot_wass2_gan_torch.py b/examples/backends/plot_wass2_gan_torch.py
index cc82f4f..f39d186 100644
--- a/examples/backends/plot_wass2_gan_torch.py
+++ b/examples/backends/plot_wass2_gan_torch.py
@@ -19,13 +19,13 @@ optimization problem:
In practice we do not have access to the full distribution :math:`\mu_d` but
-samples and we cannot compute the Wasserstein distance for lare dataset.
+samples and we cannot compute the Wasserstein distance for large dataset.
[Arjovsky2017] proposed to approximate the dual potential of Wasserstein 1
with a neural network recovering an optimization problem similar to GAN.
In this example
we will optimize the expectation of the Wasserstein distance over minibatches
at each iterations as proposed in [Genevay2018]. Optimizing the Minibatches
-of the Wasserstein distance has been studied in[Fatras2019].
+of the Wasserstein distance has been studied in [Fatras2019].
[Arjovsky2017] Arjovsky, M., Chintala, S., & Bottou, L. (2017, July).
Wasserstein generative adversarial networks. In International conference
@@ -183,7 +183,7 @@ for i in range(9):
# %%
# Animate trajectories of generated samples along iteration
-# -------------------------------------------------------
+# ---------------------------------------------------------
pl.figure(4, (8, 8))