summaryrefslogtreecommitdiff
path: root/examples/gromov/plot_semirelaxed_fgw.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_semirelaxed_fgw.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_semirelaxed_fgw.py')
-rw-r--r--examples/gromov/plot_semirelaxed_fgw.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/examples/gromov/plot_semirelaxed_fgw.py b/examples/gromov/plot_semirelaxed_fgw.py
index ef4b286..579f23d 100644
--- a/examples/gromov/plot_semirelaxed_fgw.py
+++ b/examples/gromov/plot_semirelaxed_fgw.py
@@ -1,8 +1,8 @@
# -*- coding: utf-8 -*-
"""
-==========================
+===============================================
Semi-relaxed (Fused) Gromov-Wasserstein example
-==========================
+===============================================
This example is designed to show how to use the semi-relaxed Gromov-Wasserstein
and the semi-relaxed Fused Gromov-Wasserstein divergences.
@@ -34,7 +34,7 @@ from networkx.generators.community import stochastic_block_model as sbm
#############################################################################
#
# Generate two graphs following Stochastic Block models of 2 and 3 clusters.
-# ---------------------------------------------
+# --------------------------------------------------------------------------
N2 = 20 # 2 communities
@@ -85,7 +85,7 @@ for i, j in G3.edges():
#############################################################################
#
# Compute their semi-relaxed Gromov-Wasserstein divergences
-# ---------------------------------------------
+# ---------------------------------------------------------
# 0) GW(C2, h2, C3, h3) for reference
OT, log = gromov_wasserstein(C2, C3, h2, h3, symmetric=True, log=True)
@@ -110,7 +110,7 @@ print('srGW(C3, h3, C2) = ', srgw_32)
#############################################################################
#
# Visualization of the semi-relaxed Gromov-Wasserstein matchings
-# ---------------------------------------------
+# --------------------------------------------------------------
#
# We color nodes of the graph on the right - then project its node colors
# based on the optimal transport plan from the srGW matching
@@ -226,7 +226,7 @@ pl.show()
#############################################################################
#
# Add node features
-# ---------------------------------------------
+# -----------------
# We add node features with given mean - by clusters
# and inversely proportional to clusters' intra-connectivity
@@ -242,7 +242,7 @@ for i, c in enumerate(part_G3):
#############################################################################
#
# Compute their semi-relaxed Fused Gromov-Wasserstein divergences
-# ---------------------------------------------
+# ---------------------------------------------------------------
alpha = 0.5
# Compute pairwise euclidean distance between node features
@@ -272,7 +272,7 @@ print('srGW(C3, F3, h3, C2, F2) = ', srfgw_32)
#############################################################################
#
# Visualization of the semi-relaxed Fused Gromov-Wasserstein matchings
-# ---------------------------------------------
+# --------------------------------------------------------------------
#
# We color nodes of the graph on the right - then project its node colors
# based on the optimal transport plan from the srFGW matching