diff options
author | Hicham Janati <hicham.janati@inria.fr> | 2019-06-18 22:26:48 +0200 |
---|---|---|
committer | Hicham Janati <hicham.janati@inria.fr> | 2019-06-18 22:26:48 +0200 |
commit | adf9d046445bf142a29d914352f397b36f7905c0 (patch) | |
tree | e13c7231390288fafd6eb09702db1cde6521a81f /examples | |
parent | 897982718a5fd81a9a591d80a7d50839399fc088 (diff) |
update Readme + minor rendering in examples
Diffstat (limited to 'examples')
-rw-r--r-- | examples/plot_UOT_1D.py | 8 | ||||
-rw-r--r-- | examples/plot_UOT_barycenter_1D.py | 10 |
2 files changed, 9 insertions, 9 deletions
diff --git a/examples/plot_UOT_1D.py b/examples/plot_UOT_1D.py index 59b7e77..2ea8b05 100644 --- a/examples/plot_UOT_1D.py +++ b/examples/plot_UOT_1D.py @@ -1,8 +1,8 @@ # -*- coding: utf-8 -*- """ -==================== +=============================== 1D Unbalanced optimal transport -==================== +=============================== This example illustrates the computation of Unbalanced Optimal transport using a Kullback-Leibler relaxation. @@ -53,7 +53,7 @@ pl.plot(x, a, 'b', label='Source distribution') pl.plot(x, b, 'r', label='Target distribution') pl.legend() -#%% plot distributions and loss matrix +# plot distributions and loss matrix pl.figure(2, figsize=(5, 5)) ot.plot.plot1D_mat(a, b, M, 'Cost matrix M') @@ -64,7 +64,7 @@ ot.plot.plot1D_mat(a, b, M, 'Cost matrix M') # -------------- -#%% Sinkhorn +# Sinkhorn epsilon = 0.1 # entropy parameter alpha = 1. # Unbalanced KL relaxation parameter diff --git a/examples/plot_UOT_barycenter_1D.py b/examples/plot_UOT_barycenter_1D.py index 8dfb84f..c8d9d3b 100644 --- a/examples/plot_UOT_barycenter_1D.py +++ b/examples/plot_UOT_barycenter_1D.py @@ -27,7 +27,7 @@ from matplotlib.collections import PolyCollection # Generate data # ------------- -#%% parameters +# parameters n = 100 # nb bins @@ -53,7 +53,7 @@ M /= M.max() # Plot data # --------- -#%% plot the distributions +# plot the distributions pl.figure(1, figsize=(6.4, 3)) for i in range(n_distributions): @@ -65,7 +65,7 @@ pl.tight_layout() # Barycenter computation # ---------------------- -#%% non weighted barycenter computation +# non weighted barycenter computation weight = 0.5 # 0<=weight<=1 weights = np.array([1 - weight, weight]) @@ -97,7 +97,7 @@ pl.tight_layout() # Barycentric interpolation # ------------------------- -#%% barycenter interpolation +# barycenter interpolation n_weight = 11 weight_list = np.linspace(0, 1, n_weight) @@ -114,7 +114,7 @@ for i in range(0, n_weight): B_wass[:, i] = ot.unbalanced.barycenter_unbalanced(A, M, reg, alpha, weights) -#%% plot interpolation +# plot interpolation pl.figure(3) |