diff options
author | RĂ©mi Flamary <remi.flamary@gmail.com> | 2020-12-22 18:35:40 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-22 18:35:40 +0100 |
commit | f6139428e70ce964de3bef703ef13aa701a83620 (patch) | |
tree | dac5b59d6b53fdbc4bcfda2db7eb666cbcaa49af /examples | |
parent | cb3e24aea8a2492ccb7e7664533ea3543b14c8ac (diff) |
[WIP] Update documentation "Why OT" section (#220)
* add some text + discussion sinkhorn
* stating wrk on why POT
* fix sphinx warnings + make html-noplot
* discussion when not to use POT
* add discussion which sinkhorn
* edits on quickstart
* more
* remove warnings :any:
* more
* done
* remove ref
Co-authored-by: Alexandre Gramfort <alexandre.gramfort@m4x.org>
Diffstat (limited to 'examples')
-rw-r--r-- | examples/barycenters/plot_free_support_barycenter.py | 4 | ||||
-rw-r--r-- | examples/domain-adaptation/plot_otda_jcpot.py | 4 | ||||
-rw-r--r-- | examples/gromov/plot_barycenter_fgw.py | 2 | ||||
-rw-r--r-- | examples/gromov/plot_fgw.py | 10 | ||||
-rw-r--r-- | examples/plot_OT_1D_smooth.py | 2 | ||||
-rw-r--r-- | examples/plot_OT_2D_samples.py | 2 | ||||
-rw-r--r-- | examples/sliced-wasserstein/plot_variance.py | 16 | ||||
-rw-r--r-- | examples/unbalanced-partial/plot_UOT_1D.py | 3 |
8 files changed, 22 insertions, 21 deletions
diff --git a/examples/barycenters/plot_free_support_barycenter.py b/examples/barycenters/plot_free_support_barycenter.py index 27ddc8e..2d68a39 100644 --- a/examples/barycenters/plot_free_support_barycenter.py +++ b/examples/barycenters/plot_free_support_barycenter.py @@ -1,8 +1,8 @@ # -*- coding: utf-8 -*- """ -==================================================== +======================================================== 2D free support Wasserstein barycenters of distributions -==================================================== +======================================================== Illustration of 2D Wasserstein barycenters if distributions are weighted sum of diracs. diff --git a/examples/domain-adaptation/plot_otda_jcpot.py b/examples/domain-adaptation/plot_otda_jcpot.py index c495690..0d974f4 100644 --- a/examples/domain-adaptation/plot_otda_jcpot.py +++ b/examples/domain-adaptation/plot_otda_jcpot.py @@ -1,8 +1,8 @@ # -*- coding: utf-8 -*- """ -======================== +================================ OT for multi-source target shift -======================== +================================ This example introduces a target shift problem with two 2D source and 1 target domain. diff --git a/examples/gromov/plot_barycenter_fgw.py b/examples/gromov/plot_barycenter_fgw.py index 3f81765..556e08f 100644 --- a/examples/gromov/plot_barycenter_fgw.py +++ b/examples/gromov/plot_barycenter_fgw.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- """ ================================= -Plot graphs' barycenter using FGW +Plot graphs barycenter using FGW ================================= This example illustrates the computation barycenter of labeled graphs using diff --git a/examples/gromov/plot_fgw.py b/examples/gromov/plot_fgw.py index 97fe619..5475fb3 100644 --- a/examples/gromov/plot_fgw.py +++ b/examples/gromov/plot_fgw.py @@ -26,7 +26,7 @@ from ot.gromov import gromov_wasserstein, fused_gromov_wasserstein ############################################################################## # Generate data -# --------- +# ------------- #%% parameters # We create two 1D random measures @@ -76,7 +76,7 @@ pl.show() ############################################################################## # Create structure matrices and across-feature distance matrix -# --------- +# ------------------------------------------------------------ #%% Structure matrices and across-features distance matrix C1 = ot.dist(xs) @@ -88,7 +88,7 @@ Got = ot.emd([], [], M) ############################################################################## # Plot matrices -# --------- +# ------------- #%% cmap = 'Reds' @@ -131,7 +131,7 @@ pl.show() ############################################################################## # Compute FGW/GW -# --------- +# -------------- #%% Computing FGW and GW alpha = 1e-3 @@ -145,7 +145,7 @@ Gg, log = gromov_wasserstein(C1, C2, p, q, loss_fun='square_loss', verbose=True, ############################################################################## # Visualize transport matrices -# --------- +# ---------------------------- #%% visu OT matrix cmap = 'Blues' diff --git a/examples/plot_OT_1D_smooth.py b/examples/plot_OT_1D_smooth.py index 75cd295..b07f99f 100644 --- a/examples/plot_OT_1D_smooth.py +++ b/examples/plot_OT_1D_smooth.py @@ -87,7 +87,7 @@ pl.show() ############################################################################## # Solve Smooth OT -# -------------- +# --------------- #%% Smooth OT with KL regularization diff --git a/examples/plot_OT_2D_samples.py b/examples/plot_OT_2D_samples.py index 1544e82..af1bc12 100644 --- a/examples/plot_OT_2D_samples.py +++ b/examples/plot_OT_2D_samples.py @@ -107,7 +107,7 @@ pl.show() ############################################################################## # Emprirical Sinkhorn -# ---------------- +# ------------------- #%% sinkhorn diff --git a/examples/sliced-wasserstein/plot_variance.py b/examples/sliced-wasserstein/plot_variance.py index f3deeff..27df656 100644 --- a/examples/sliced-wasserstein/plot_variance.py +++ b/examples/sliced-wasserstein/plot_variance.py @@ -4,9 +4,11 @@ 2D Sliced Wasserstein Distance ============================== -This example illustrates the computation of the sliced Wasserstein Distance as proposed in [31]. +This example illustrates the computation of the sliced Wasserstein Distance as +proposed in [31]. -[31] Bonneel, Nicolas, et al. "Sliced and radon wasserstein barycenters of measures." Journal of Mathematical Imaging and Vision 51.1 (2015): 22-45 +[31] Bonneel, Nicolas, et al. "Sliced and radon wasserstein barycenters of +measures." Journal of Mathematical Imaging and Vision 51.1 (2015): 22-45 """ @@ -50,9 +52,9 @@ pl.plot(xt[:, 0], xt[:, 1], 'xr', label='Target samples') pl.legend(loc=0) pl.title('Source and target distributions') -################################################################################### -# Compute Sliced Wasserstein distance for different seeds and number of projections -# ----------- +############################################################################### +# Sliced Wasserstein distance for different seeds and number of projections +# ------------------------------------------------------------------------- n_seed = 50 n_projections_arr = np.logspace(0, 3, 25, dtype=int) @@ -66,9 +68,9 @@ for seed in range(n_seed): res_mean = np.mean(res, axis=0) res_std = np.std(res, axis=0) -################################################################################### +############################################################################### # Plot Sliced Wasserstein Distance -# ----------- +# -------------------------------- pl.figure(2) pl.plot(n_projections_arr, res_mean, label="SWD") diff --git a/examples/unbalanced-partial/plot_UOT_1D.py b/examples/unbalanced-partial/plot_UOT_1D.py index 2ea8b05..183849c 100644 --- a/examples/unbalanced-partial/plot_UOT_1D.py +++ b/examples/unbalanced-partial/plot_UOT_1D.py @@ -61,8 +61,7 @@ ot.plot.plot1D_mat(a, b, M, 'Cost matrix M') ############################################################################## # Solve Unbalanced Sinkhorn -# -------------- - +# ------------------------- # Sinkhorn |