diff options
author | Rémi Flamary <remi.flamary@gmail.com> | 2017-08-31 09:28:37 +0200 |
---|---|---|
committer | Rémi Flamary <remi.flamary@gmail.com> | 2017-08-31 09:28:37 +0200 |
commit | 212f3889b1114026765cda0134e02766daa82af2 (patch) | |
tree | f9ea2d2566d1544b3409152f8ebbc8ca706c96e2 /examples/plot_OT_2D_samples.py | |
parent | ec67362de5ec785e3871eac75a8aa477857092c4 (diff) |
update tests
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 |