summaryrefslogtreecommitdiff
path: root/examples/gromov/plot_gromov_wasserstein_dictionary_learning.py
diff options
context:
space:
mode:
authorOleksii Kachaiev <kachayev@gmail.com>2023-05-03 10:36:09 +0200
committerGitHub <noreply@github.com>2023-05-03 10:36:09 +0200
commit2aeb591be6b19a93f187516495ed15f1a47be925 (patch)
tree9a6f759856a3f6b2d7c6db3514927ba3e5af10b5 /examples/gromov/plot_gromov_wasserstein_dictionary_learning.py
parent8a7035bdaa5bb164d1c16febbd83650d1fb6d393 (diff)
[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>
Diffstat (limited to 'examples/gromov/plot_gromov_wasserstein_dictionary_learning.py')
-rwxr-xr-xexamples/gromov/plot_gromov_wasserstein_dictionary_learning.py24
1 files changed, 12 insertions, 12 deletions
diff --git a/examples/gromov/plot_gromov_wasserstein_dictionary_learning.py b/examples/gromov/plot_gromov_wasserstein_dictionary_learning.py
index 7585944..8cccf88 100755
--- a/examples/gromov/plot_gromov_wasserstein_dictionary_learning.py
+++ b/examples/gromov/plot_gromov_wasserstein_dictionary_learning.py
@@ -1,11 +1,11 @@
# -*- coding: utf-8 -*-
r"""
-=================================
+=====================================================
(Fused) Gromov-Wasserstein Linear Dictionary Learning
-=================================
+=====================================================
-In this exemple, we illustrate how to learn a Gromov-Wasserstein dictionary on
+In this example, we illustrate how to learn a Gromov-Wasserstein dictionary on
a dataset of structured data such as graphs, denoted
:math:`\{ \mathbf{C_s} \}_{s \in [S]}` where every nodes have uniform weights.
Given a dictionary :math:`\mathbf{C_{dict}}` composed of D structures of a fixed
@@ -49,7 +49,7 @@ from networkx.generators.community import stochastic_block_model as sbm
#############################################################################
#
# Generate a dataset composed of graphs following Stochastic Block models of 1, 2 and 3 clusters.
-# ---------------------------------------------
+# -----------------------------------------------------------------------------------------------
np.random.seed(42)
@@ -112,8 +112,8 @@ pl.show()
#############################################################################
#
-# Estimate the gromov-wasserstein dictionary from the dataset
-# ---------------------------------------------
+# Estimate the Gromov-Wasserstein dictionary from the dataset
+# -----------------------------------------------------------
np.random.seed(0)
@@ -144,7 +144,7 @@ pl.show()
#############################################################################
#
# Visualization of the estimated dictionary atoms
-# ---------------------------------------------
+# -----------------------------------------------
# Continuous connections between nodes of the atoms are colored in shades of grey (1: dark / 2: white)
@@ -169,7 +169,7 @@ pl.show()
#############################################################################
#
# Visualization of the embedding space
-# ---------------------------------------------
+# ------------------------------------
unmixings = []
reconstruction_errors = []
@@ -217,7 +217,7 @@ pl.show()
#############################################################################
#
# Endow the dataset with node features
-# ---------------------------------------------
+# ------------------------------------
# We follow this feature assignment on all nodes of a graph depending on its label/number of clusters
# 1 cluster --> 0 as nodes feature
# 2 clusters --> 1 as nodes feature
@@ -257,7 +257,7 @@ pl.show()
#############################################################################
#
# Estimate a Fused Gromov-Wasserstein dictionary from the dataset of attributed graphs
-# ---------------------------------------------
+# ------------------------------------------------------------------------------------
np.random.seed(0)
ps = [ot.unif(C.shape[0]) for C in dataset]
D = 3 # 6 atoms instead of 3
@@ -286,7 +286,7 @@ pl.show()
#############################################################################
#
# Visualization of the estimated dictionary atoms
-# ---------------------------------------------
+# -----------------------------------------------
pl.figure(7, (12, 8))
pl.clf()
@@ -313,7 +313,7 @@ pl.show()
#############################################################################
#
# Visualization of the embedding space
-# ---------------------------------------------
+# ------------------------------------
unmixings = []
reconstruction_errors = []