From dd3546baf9c59733b2109a971293eba48d2eaed3 Mon Sep 17 00:00:00 2001 From: RĂ©mi Flamary Date: Fri, 15 Sep 2017 13:57:01 +0200 Subject: add all files for doc --- examples/plot_gromov_barycenter.py | 42 +++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 21 deletions(-) (limited to 'examples/plot_gromov_barycenter.py') 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] -- cgit v1.2.3