summaryrefslogtreecommitdiff
path: root/examples/plot_gromov_barycenter.py
diff options
context:
space:
mode:
authorRémi Flamary <remi.flamary@gmail.com>2017-09-15 13:57:01 +0200
committerRémi Flamary <remi.flamary@gmail.com>2017-09-15 13:57:01 +0200
commitdd3546baf9c59733b2109a971293eba48d2eaed3 (patch)
treedbc9c5dd126eecf537acbe7d205b91250f2bdc9b /examples/plot_gromov_barycenter.py
parentbad3d95523d005a4fbf64dd009c716b9dd560fe3 (diff)
add all files for doc
Diffstat (limited to 'examples/plot_gromov_barycenter.py')
-rwxr-xr-xexamples/plot_gromov_barycenter.py42
1 files changed, 21 insertions, 21 deletions
diff --git a/examples/plot_gromov_barycenter.py b/examples/plot_gromov_barycenter.py
index 93533c0..180b0cf 100755
--- a/examples/plot_gromov_barycenter.py
+++ b/examples/plot_gromov_barycenter.py
@@ -24,12 +24,12 @@ from sklearn.decomposition import PCA
import ot
-"""
-Smacof MDS
-==========
-This function allows to find an embedding of points given a dissimilarity matrix
-that will be given by the output of the algorithm
-"""
+##############################################################################
+# Smacof MDS
+# ----------
+#
+# This function allows to find an embedding of points given a dissimilarity matrix
+# that will be given by the output of the algorithm
def smacof_mds(C, dim, max_iter=3000, eps=1e-9):
@@ -78,11 +78,11 @@ def smacof_mds(C, dim, max_iter=3000, eps=1e-9):
return npos
-"""
-Data preparation
-================
-The four distributions are constructed from 4 simple images
-"""
+##############################################################################
+# Data preparation
+# ----------------
+#
+# The four distributions are constructed from 4 simple images
def im2mat(I):
@@ -110,12 +110,11 @@ for nb in range(4):
xs = np.array([np.array(xs[0]), np.array(xs[1]),
np.array(xs[2]), np.array(xs[3])])
+##############################################################################
+# Barycenter computation
+# ----------------------
+
-"""
-Barycenter computation
-======================
-The four distributions are constructed from 4 simple images
-"""
ns = [len(xs[s]) for s in range(S)]
n_samples = 30
@@ -157,12 +156,13 @@ for i in range(2):
], p, lambdast[i], 'square_loss', 5e-4,
max_iter=100, tol=1e-3)
-"""
-Visualization
-=============
-"""
-"""The PCA helps in getting consistency between the rotations"""
+##############################################################################
+# Visualization
+# -------------
+#
+# The PCA helps in getting consistency between the rotations
+
clf = PCA(n_components=2)
npos = [0, 0, 0, 0]