summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorNicolas Courty <Nico@MacBook-Pro-de-Nicolas.local>2017-09-13 01:03:21 +0200
committerNicolas Courty <Nico@MacBook-Pro-de-Nicolas.local>2017-09-13 01:03:21 +0200
commit84c272394d41d159d07174306b324590b3ffe40c (patch)
treecda14e19f03f3f5a2038060b35cc4bb3ba83c0a9 /examples
parent24784eda59cf591746bf4ba62f325c5612ada430 (diff)
Corrections on Gromov
Diffstat (limited to 'examples')
-rw-r--r--examples/plot_gromov.py4
-rwxr-xr-xexamples/plot_gromov_barycenter.py18
2 files changed, 12 insertions, 10 deletions
diff --git a/examples/plot_gromov.py b/examples/plot_gromov.py
index 0f839a3..dce66c4 100644
--- a/examples/plot_gromov.py
+++ b/examples/plot_gromov.py
@@ -22,8 +22,8 @@ import ot
"""
Sample two Gaussian distributions (2D and 3D)
=============================================
-The Gromov-Wasserstein distance allows to compute distances with samples that
-do not belong to the same metric space. For demonstration purpose, we sample
+The Gromov-Wasserstein distance allows to compute distances with samples that
+do not belong to the same metric space. For demonstration purpose, we sample
two Gaussian distributions in 2- and 3-dimensional spaces.
"""
diff --git a/examples/plot_gromov_barycenter.py b/examples/plot_gromov_barycenter.py
index c138031..52f4966 100755
--- a/examples/plot_gromov_barycenter.py
+++ b/examples/plot_gromov_barycenter.py
@@ -3,7 +3,7 @@
=====================================
Gromov-Wasserstein Barycenter example
=====================================
-This example is designed to show how to use the Gromov-Wassertsein distance
+This example is designed to show how to use the Gromov-Wasserstein distance
computation in POT.
"""
@@ -34,8 +34,9 @@ that will be given by the output of the algorithm
def smacof_mds(C, dim, max_iter=3000, eps=1e-9):
"""
- Returns an interpolated point cloud following the dissimilarity matrix C using SMACOF
- multidimensional scaling (MDS) in specific dimensionned target space
+ Returns an interpolated point cloud following the dissimilarity matrix C
+ using SMACOF multidimensional scaling (MDS) in specific dimensionned
+ target space
Parameters
----------
@@ -51,7 +52,8 @@ def smacof_mds(C, dim, max_iter=3000, eps=1e-9):
Returns
-------
npos : ndarray, shape (R, dim)
- Embedded coordinates of the interpolated point cloud (defined with one isometry)
+ Embedded coordinates of the interpolated point cloud (defined with
+ one isometry)
"""
rng = np.random.RandomState(seed=3)
@@ -88,10 +90,10 @@ def im2mat(I):
return I.reshape((I.shape[0] * I.shape[1], I.shape[2]))
-square = spi.imread('../data/square.png').astype(np.float64)[:,:,2] / 256
-cross = spi.imread('../data/cross.png').astype(np.float64)[:,:,2] / 256
-triangle = spi.imread('../data/triangle.png').astype(np.float64)[:,:,2] / 256
-star = spi.imread('../data/star.png').astype(np.float64)[:,:,2] / 256
+square = spi.imread('../data/square.png').astype(np.float64)[:, :, 2] / 256
+cross = spi.imread('../data/cross.png').astype(np.float64)[:, :, 2] / 256
+triangle = spi.imread('../data/triangle.png').astype(np.float64)[:, :, 2] / 256
+star = spi.imread('../data/star.png').astype(np.float64)[:, :, 2] / 256
shapes = [square, cross, triangle, star]