summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorRĂ©mi Flamary <remi.flamary@gmail.com>2020-04-28 09:50:45 +0200
committerGitHub <noreply@github.com>2020-04-28 09:50:45 +0200
commitafedeebf5bdd58ff92f52c73b9b41b8a8e66ca29 (patch)
tree60fafb54d66aa843965c000d48d249780afdcf75 /examples
parentb53fb23b538e0b7f6498bc217f02adac3c8f7d07 (diff)
parent3b0732b041d46df66cb182b17f6ece040c578722 (diff)
Merge pull request #160 from PythonOT/doc_cov
[MRG] Update documentation and improve coverage
Diffstat (limited to 'examples')
-rw-r--r--examples/README.txt8
-rw-r--r--examples/barycenters/README.txt4
-rw-r--r--examples/barycenters/plot_barycenter_1D.py (renamed from examples/plot_barycenter_1D.py)2
-rw-r--r--examples/barycenters/plot_barycenter_lp_vs_entropic.py (renamed from examples/plot_barycenter_lp_vs_entropic.py)2
-rw-r--r--examples/barycenters/plot_convolutional_barycenter.py (renamed from examples/plot_convolutional_barycenter.py)8
-rw-r--r--examples/barycenters/plot_free_support_barycenter.py (renamed from examples/plot_free_support_barycenter.py)0
-rw-r--r--examples/domain-adaptation/README.txt5
-rw-r--r--examples/domain-adaptation/plot_otda_classes.py (renamed from examples/plot_otda_classes.py)0
-rw-r--r--examples/domain-adaptation/plot_otda_color_images.py (renamed from examples/plot_otda_color_images.py)6
-rw-r--r--examples/domain-adaptation/plot_otda_d2.py (renamed from examples/plot_otda_d2.py)2
-rw-r--r--examples/domain-adaptation/plot_otda_jcpot.py (renamed from examples/plot_otda_jcpot.py)0
-rw-r--r--examples/domain-adaptation/plot_otda_laplacian.py (renamed from examples/plot_otda_laplacian.py)0
-rw-r--r--examples/domain-adaptation/plot_otda_linear_mapping.py (renamed from examples/plot_otda_linear_mapping.py)6
-rw-r--r--examples/domain-adaptation/plot_otda_mapping.py (renamed from examples/plot_otda_mapping.py)2
-rw-r--r--examples/domain-adaptation/plot_otda_mapping_colors_images.py (renamed from examples/plot_otda_mapping_colors_images.py)6
-rw-r--r--examples/domain-adaptation/plot_otda_semi_supervised.py (renamed from examples/plot_otda_semi_supervised.py)2
-rw-r--r--examples/gromov/README.txt4
-rw-r--r--examples/gromov/plot_barycenter_fgw.py (renamed from examples/plot_barycenter_fgw.py)0
-rw-r--r--examples/gromov/plot_fgw.py (renamed from examples/plot_fgw.py)2
-rw-r--r--examples/gromov/plot_gromov.py (renamed from examples/plot_gromov.py)0
-rwxr-xr-xexamples/gromov/plot_gromov_barycenter.py (renamed from examples/plot_gromov_barycenter.py)8
-rw-r--r--examples/others/README.txt5
-rw-r--r--examples/others/plot_WDA.py (renamed from examples/plot_WDA.py)2
-rw-r--r--examples/plot_OT_1D.py1
-rw-r--r--examples/plot_OT_1D_smooth.py2
-rw-r--r--examples/plot_OT_2D_samples.py2
-rw-r--r--examples/plot_OT_L1_vs_L2.py2
-rw-r--r--examples/plot_compute_emd.py2
-rw-r--r--examples/plot_optim_OTreg.py1
-rw-r--r--examples/unbalanced-partial/README.txt3
-rw-r--r--examples/unbalanced-partial/plot_UOT_1D.py (renamed from examples/plot_UOT_1D.py)0
-rw-r--r--examples/unbalanced-partial/plot_UOT_barycenter_1D.py (renamed from examples/plot_UOT_barycenter_1D.py)2
-rwxr-xr-xexamples/unbalanced-partial/plot_partial_wass_and_gromov.py (renamed from examples/plot_partial_wass_and_gromov.py)2
33 files changed, 75 insertions, 16 deletions
diff --git a/examples/README.txt b/examples/README.txt
index b08d3f1..69a9f84 100644
--- a/examples/README.txt
+++ b/examples/README.txt
@@ -1,4 +1,8 @@
-POT Examples
-============
+Examples gallery
+================
This is a gallery of all the POT example files.
+
+
+OT and regularized OT
+--------------------- \ No newline at end of file
diff --git a/examples/barycenters/README.txt b/examples/barycenters/README.txt
new file mode 100644
index 0000000..8461f7f
--- /dev/null
+++ b/examples/barycenters/README.txt
@@ -0,0 +1,4 @@
+
+
+Wasserstein barycenters
+----------------------- \ No newline at end of file
diff --git a/examples/plot_barycenter_1D.py b/examples/barycenters/plot_barycenter_1D.py
index 6864301..63dc460 100644
--- a/examples/plot_barycenter_1D.py
+++ b/examples/barycenters/plot_barycenter_1D.py
@@ -18,6 +18,8 @@ SIAM Journal on Scientific Computing, 37(2), A1111-A1138.
#
# License: MIT License
+# sphinx_gallery_thumbnail_number = 4
+
import numpy as np
import matplotlib.pylab as pl
import ot
diff --git a/examples/plot_barycenter_lp_vs_entropic.py b/examples/barycenters/plot_barycenter_lp_vs_entropic.py
index d7c72d0..57a6bac 100644
--- a/examples/plot_barycenter_lp_vs_entropic.py
+++ b/examples/barycenters/plot_barycenter_lp_vs_entropic.py
@@ -21,6 +21,8 @@ SIAM Journal on Scientific Computing, 37(2), A1111-A1138.
#
# License: MIT License
+# sphinx_gallery_thumbnail_number = 4
+
import numpy as np
import matplotlib.pylab as pl
import ot
diff --git a/examples/plot_convolutional_barycenter.py b/examples/barycenters/plot_convolutional_barycenter.py
index e74db04..cbcd4a1 100644
--- a/examples/plot_convolutional_barycenter.py
+++ b/examples/barycenters/plot_convolutional_barycenter.py
@@ -26,10 +26,10 @@ import ot
# The four distributions are constructed from 4 simple images
-f1 = 1 - pl.imread('../data/redcross.png')[:, :, 2]
-f2 = 1 - pl.imread('../data/duck.png')[:, :, 2]
-f3 = 1 - pl.imread('../data/heart.png')[:, :, 2]
-f4 = 1 - pl.imread('../data/tooth.png')[:, :, 2]
+f1 = 1 - pl.imread('../../data/redcross.png')[:, :, 2]
+f2 = 1 - pl.imread('../../data/duck.png')[:, :, 2]
+f3 = 1 - pl.imread('../../data/heart.png')[:, :, 2]
+f4 = 1 - pl.imread('../../data/tooth.png')[:, :, 2]
A = []
f1 = f1 / np.sum(f1)
diff --git a/examples/plot_free_support_barycenter.py b/examples/barycenters/plot_free_support_barycenter.py
index 64b89e4..64b89e4 100644
--- a/examples/plot_free_support_barycenter.py
+++ b/examples/barycenters/plot_free_support_barycenter.py
diff --git a/examples/domain-adaptation/README.txt b/examples/domain-adaptation/README.txt
new file mode 100644
index 0000000..81dd8d2
--- /dev/null
+++ b/examples/domain-adaptation/README.txt
@@ -0,0 +1,5 @@
+
+
+
+Domain adaptation examples
+-------------------------- \ No newline at end of file
diff --git a/examples/plot_otda_classes.py b/examples/domain-adaptation/plot_otda_classes.py
index f028022..f028022 100644
--- a/examples/plot_otda_classes.py
+++ b/examples/domain-adaptation/plot_otda_classes.py
diff --git a/examples/plot_otda_color_images.py b/examples/domain-adaptation/plot_otda_color_images.py
index d9cbd2b..929365e 100644
--- a/examples/plot_otda_color_images.py
+++ b/examples/domain-adaptation/plot_otda_color_images.py
@@ -17,6 +17,8 @@ SIAM Journal on Imaging Sciences, 7(3), 1853-1882.
#
# License: MIT License
+# sphinx_gallery_thumbnail_number = 2
+
import numpy as np
import matplotlib.pylab as pl
import ot
@@ -44,8 +46,8 @@ def minmax(I):
# -------------
# Loading images
-I1 = pl.imread('../data/ocean_day.jpg').astype(np.float64) / 256
-I2 = pl.imread('../data/ocean_sunset.jpg').astype(np.float64) / 256
+I1 = pl.imread('../../data/ocean_day.jpg').astype(np.float64) / 256
+I2 = pl.imread('../../data/ocean_sunset.jpg').astype(np.float64) / 256
X1 = im2mat(I1)
X2 = im2mat(I2)
diff --git a/examples/plot_otda_d2.py b/examples/domain-adaptation/plot_otda_d2.py
index cf22c2f..f49a570 100644
--- a/examples/plot_otda_d2.py
+++ b/examples/domain-adaptation/plot_otda_d2.py
@@ -18,6 +18,8 @@ of what the transport methods are doing.
#
# License: MIT License
+# sphinx_gallery_thumbnail_number = 2
+
import matplotlib.pylab as pl
import ot
import ot.plot
diff --git a/examples/plot_otda_jcpot.py b/examples/domain-adaptation/plot_otda_jcpot.py
index c495690..c495690 100644
--- a/examples/plot_otda_jcpot.py
+++ b/examples/domain-adaptation/plot_otda_jcpot.py
diff --git a/examples/plot_otda_laplacian.py b/examples/domain-adaptation/plot_otda_laplacian.py
index 67c8f67..67c8f67 100644
--- a/examples/plot_otda_laplacian.py
+++ b/examples/domain-adaptation/plot_otda_laplacian.py
diff --git a/examples/plot_otda_linear_mapping.py b/examples/domain-adaptation/plot_otda_linear_mapping.py
index c65bd4f..dbf16b8 100644
--- a/examples/plot_otda_linear_mapping.py
+++ b/examples/domain-adaptation/plot_otda_linear_mapping.py
@@ -12,6 +12,8 @@ Linear OT mapping estimation
#
# License: MIT License
+# sphinx_gallery_thumbnail_number = 2
+
import numpy as np
import pylab as pl
import ot
@@ -92,8 +94,8 @@ def minmax(I):
# Loading images
-I1 = pl.imread('../data/ocean_day.jpg').astype(np.float64) / 256
-I2 = pl.imread('../data/ocean_sunset.jpg').astype(np.float64) / 256
+I1 = pl.imread('../../data/ocean_day.jpg').astype(np.float64) / 256
+I2 = pl.imread('../../data/ocean_sunset.jpg').astype(np.float64) / 256
X1 = im2mat(I1)
diff --git a/examples/plot_otda_mapping.py b/examples/domain-adaptation/plot_otda_mapping.py
index 5880adf..ded2bdf 100644
--- a/examples/plot_otda_mapping.py
+++ b/examples/domain-adaptation/plot_otda_mapping.py
@@ -18,6 +18,8 @@ a linear or a kernelized mapping as introduced in [8].
#
# License: MIT License
+# sphinx_gallery_thumbnail_number = 2
+
import numpy as np
import matplotlib.pylab as pl
import ot
diff --git a/examples/plot_otda_mapping_colors_images.py b/examples/domain-adaptation/plot_otda_mapping_colors_images.py
index a0938a0..9d3a7c7 100644
--- a/examples/plot_otda_mapping_colors_images.py
+++ b/examples/domain-adaptation/plot_otda_mapping_colors_images.py
@@ -19,6 +19,8 @@ discrete optimal transport", Neural Information Processing Systems (NIPS), 2016.
#
# License: MIT License
+# sphinx_gallery_thumbnail_number = 3
+
import numpy as np
import matplotlib.pylab as pl
import ot
@@ -45,8 +47,8 @@ def minmax(I):
# -------------
# Loading images
-I1 = pl.imread('../data/ocean_day.jpg').astype(np.float64) / 256
-I2 = pl.imread('../data/ocean_sunset.jpg').astype(np.float64) / 256
+I1 = pl.imread('../../data/ocean_day.jpg').astype(np.float64) / 256
+I2 = pl.imread('../../data/ocean_sunset.jpg').astype(np.float64) / 256
X1 = im2mat(I1)
diff --git a/examples/plot_otda_semi_supervised.py b/examples/domain-adaptation/plot_otda_semi_supervised.py
index 8a67720..478c3b8 100644
--- a/examples/plot_otda_semi_supervised.py
+++ b/examples/domain-adaptation/plot_otda_semi_supervised.py
@@ -18,6 +18,8 @@ of what the transport methods are doing.
#
# License: MIT License
+# sphinx_gallery_thumbnail_number = 3
+
import matplotlib.pylab as pl
import ot
diff --git a/examples/gromov/README.txt b/examples/gromov/README.txt
new file mode 100644
index 0000000..9cc9c64
--- /dev/null
+++ b/examples/gromov/README.txt
@@ -0,0 +1,4 @@
+
+
+Gromov and Fused-Gromov-Wasserstein
+----------------------------------- \ No newline at end of file
diff --git a/examples/plot_barycenter_fgw.py b/examples/gromov/plot_barycenter_fgw.py
index 77b0370..77b0370 100644
--- a/examples/plot_barycenter_fgw.py
+++ b/examples/gromov/plot_barycenter_fgw.py
diff --git a/examples/plot_fgw.py b/examples/gromov/plot_fgw.py
index cfdc33b..73e486e 100644
--- a/examples/plot_fgw.py
+++ b/examples/gromov/plot_fgw.py
@@ -17,6 +17,8 @@ This example illustrates the computation of FGW for 1D measures[18].
#
# License: MIT License
+# sphinx_gallery_thumbnail_number = 3
+
import matplotlib.pyplot as pl
import numpy as np
import ot
diff --git a/examples/plot_gromov.py b/examples/gromov/plot_gromov.py
index deb2f86..deb2f86 100644
--- a/examples/plot_gromov.py
+++ b/examples/gromov/plot_gromov.py
diff --git a/examples/plot_gromov_barycenter.py b/examples/gromov/plot_gromov_barycenter.py
index 6b29687..f6f031a 100755
--- a/examples/plot_gromov_barycenter.py
+++ b/examples/gromov/plot_gromov_barycenter.py
@@ -89,10 +89,10 @@ def im2mat(I):
return I.reshape((I.shape[0] * I.shape[1], I.shape[2]))
-square = pl.imread('../data/square.png').astype(np.float64)[:, :, 2]
-cross = pl.imread('../data/cross.png').astype(np.float64)[:, :, 2]
-triangle = pl.imread('../data/triangle.png').astype(np.float64)[:, :, 2]
-star = pl.imread('../data/star.png').astype(np.float64)[:, :, 2]
+square = pl.imread('../../data/square.png').astype(np.float64)[:, :, 2]
+cross = pl.imread('../../data/cross.png').astype(np.float64)[:, :, 2]
+triangle = pl.imread('../../data/triangle.png').astype(np.float64)[:, :, 2]
+star = pl.imread('../../data/star.png').astype(np.float64)[:, :, 2]
shapes = [square, cross, triangle, star]
diff --git a/examples/others/README.txt b/examples/others/README.txt
new file mode 100644
index 0000000..df4c697
--- /dev/null
+++ b/examples/others/README.txt
@@ -0,0 +1,5 @@
+
+
+
+Other OT problems
+----------------- \ No newline at end of file
diff --git a/examples/plot_WDA.py b/examples/others/plot_WDA.py
index 93cc237..5e17433 100644
--- a/examples/plot_WDA.py
+++ b/examples/others/plot_WDA.py
@@ -16,6 +16,8 @@ Wasserstein Discriminant Analysis.
#
# License: MIT License
+# sphinx_gallery_thumbnail_number = 2
+
import numpy as np
import matplotlib.pylab as pl
diff --git a/examples/plot_OT_1D.py b/examples/plot_OT_1D.py
index f33e2a4..15ead96 100644
--- a/examples/plot_OT_1D.py
+++ b/examples/plot_OT_1D.py
@@ -12,6 +12,7 @@ and their visualization.
# Author: Remi Flamary <remi.flamary@unice.fr>
#
# License: MIT License
+# sphinx_gallery_thumbnail_number = 3
import numpy as np
import matplotlib.pylab as pl
diff --git a/examples/plot_OT_1D_smooth.py b/examples/plot_OT_1D_smooth.py
index b690751..75cd295 100644
--- a/examples/plot_OT_1D_smooth.py
+++ b/examples/plot_OT_1D_smooth.py
@@ -13,6 +13,8 @@ and their visualization.
#
# License: MIT License
+# sphinx_gallery_thumbnail_number = 6
+
import numpy as np
import matplotlib.pylab as pl
import ot
diff --git a/examples/plot_OT_2D_samples.py b/examples/plot_OT_2D_samples.py
index 63126ba..1544e82 100644
--- a/examples/plot_OT_2D_samples.py
+++ b/examples/plot_OT_2D_samples.py
@@ -14,6 +14,8 @@ sum of diracs. The OT matrix is plotted with the samples.
#
# License: MIT License
+# sphinx_gallery_thumbnail_number = 4
+
import numpy as np
import matplotlib.pylab as pl
import ot
diff --git a/examples/plot_OT_L1_vs_L2.py b/examples/plot_OT_L1_vs_L2.py
index 37b429f..60353ab 100644
--- a/examples/plot_OT_L1_vs_L2.py
+++ b/examples/plot_OT_L1_vs_L2.py
@@ -16,6 +16,8 @@ https://arxiv.org/pdf/1706.07650.pdf
#
# License: MIT License
+# sphinx_gallery_thumbnail_number = 3
+
import numpy as np
import matplotlib.pylab as pl
import ot
diff --git a/examples/plot_compute_emd.py b/examples/plot_compute_emd.py
index 7ed2b01..3340115 100644
--- a/examples/plot_compute_emd.py
+++ b/examples/plot_compute_emd.py
@@ -14,6 +14,8 @@ ground metrics and plot their values for diffeent distributions.
#
# License: MIT License
+# sphinx_gallery_thumbnail_number = 3
+
import numpy as np
import matplotlib.pylab as pl
import ot
diff --git a/examples/plot_optim_OTreg.py b/examples/plot_optim_OTreg.py
index 2c58def..51e2fdc 100644
--- a/examples/plot_optim_OTreg.py
+++ b/examples/plot_optim_OTreg.py
@@ -24,6 +24,7 @@ arXiv preprint arXiv:1510.06567.
"""
+# sphinx_gallery_thumbnail_number = 4
import numpy as np
import matplotlib.pylab as pl
diff --git a/examples/unbalanced-partial/README.txt b/examples/unbalanced-partial/README.txt
new file mode 100644
index 0000000..2f404f0
--- /dev/null
+++ b/examples/unbalanced-partial/README.txt
@@ -0,0 +1,3 @@
+
+Unbalanced and Partial OT
+------------------------- \ No newline at end of file
diff --git a/examples/plot_UOT_1D.py b/examples/unbalanced-partial/plot_UOT_1D.py
index 2ea8b05..2ea8b05 100644
--- a/examples/plot_UOT_1D.py
+++ b/examples/unbalanced-partial/plot_UOT_1D.py
diff --git a/examples/plot_UOT_barycenter_1D.py b/examples/unbalanced-partial/plot_UOT_barycenter_1D.py
index acb5892..931798b 100644
--- a/examples/plot_UOT_barycenter_1D.py
+++ b/examples/unbalanced-partial/plot_UOT_barycenter_1D.py
@@ -16,6 +16,8 @@ as proposed in [10] for Unbalanced inputs.
#
# License: MIT License
+# sphinx_gallery_thumbnail_number = 2
+
import numpy as np
import matplotlib.pylab as pl
import ot
diff --git a/examples/plot_partial_wass_and_gromov.py b/examples/unbalanced-partial/plot_partial_wass_and_gromov.py
index 9f95a70..0c5cbf9 100755
--- a/examples/plot_partial_wass_and_gromov.py
+++ b/examples/unbalanced-partial/plot_partial_wass_and_gromov.py
@@ -11,6 +11,8 @@ distance computation in POT.
# Author: Laetitia Chapel <laetitia.chapel@irisa.fr>
# License: MIT License
+# sphinx_gallery_thumbnail_number = 2
+
# necessary for 3d plot even if not used
from mpl_toolkits.mplot3d import Axes3D # noqa
import scipy as sp