diff options
Diffstat (limited to 'examples/plot_OT_2D_samples.py')
-rw-r--r-- | examples/plot_OT_2D_samples.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/examples/plot_OT_2D_samples.py b/examples/plot_OT_2D_samples.py index 2a42dc0..a913b8c 100644 --- a/examples/plot_OT_2D_samples.py +++ b/examples/plot_OT_2D_samples.py @@ -14,6 +14,10 @@ import numpy as np import matplotlib.pylab as pl import ot +############################################################################## +# Generate data +############################################################################## + #%% parameters and data generation n = 50 # nb samples @@ -33,6 +37,10 @@ a, b = np.ones((n,)) / n, np.ones((n,)) / n # uniform distribution on samples M = ot.dist(xs, xt) M /= M.max() +############################################################################## +# Plot data +############################################################################## + #%% plot samples pl.figure(1) @@ -45,6 +53,9 @@ pl.figure(2) pl.imshow(M, interpolation='nearest') pl.title('Cost matrix M') +############################################################################## +# Compute EMD +############################################################################## #%% EMD @@ -62,6 +73,10 @@ pl.legend(loc=0) pl.title('OT matrix with samples') +############################################################################## +# Compute Sinkhorn +############################################################################## + #%% sinkhorn # reg term |