diff options
Diffstat (limited to 'examples/plot_barycenter_1D.py')
-rw-r--r-- | examples/plot_barycenter_1D.py | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/examples/plot_barycenter_1D.py b/examples/plot_barycenter_1D.py index f3be247..142b05e 100644 --- a/examples/plot_barycenter_1D.py +++ b/examples/plot_barycenter_1D.py @@ -4,7 +4,7 @@ 1D Wasserstein barycenter demo ============================== -This example illustrate the computation of regularized Wassersyein Barycenter +This example illustrates the computation of regularized Wassersyein Barycenter as proposed in [3]. @@ -25,6 +25,9 @@ import ot from mpl_toolkits.mplot3d import Axes3D # noqa from matplotlib.collections import PolyCollection +############################################################################## +# Generate data +############################################################################## #%% parameters @@ -45,6 +48,10 @@ n_distributions = A.shape[1] M = ot.utils.dist0(n) M /= M.max() +############################################################################## +# Plot data +############################################################################## + #%% plot the distributions pl.figure(1, figsize=(6.4, 3)) @@ -53,6 +60,10 @@ for i in range(n_distributions): pl.title('Distributions') pl.tight_layout() +############################################################################## +# Barycenter computation +############################################################################## + #%% barycenter computation alpha = 0.2 # 0<=alpha<=1 @@ -79,6 +90,10 @@ pl.legend() pl.title('Barycenters') pl.tight_layout() +############################################################################## +# Barycentric interpolation +############################################################################## + #%% barycenter interpolation n_alpha = 11 |