summaryrefslogtreecommitdiff
path: root/examples/plot_otda_mapping.py
diff options
context:
space:
mode:
authorRémi Flamary <remi.flamary@gmail.com>2017-08-31 09:28:37 +0200
committerRémi Flamary <remi.flamary@gmail.com>2017-08-31 09:28:37 +0200
commit212f3889b1114026765cda0134e02766daa82af2 (patch)
treef9ea2d2566d1544b3409152f8ebbc8ca706c96e2 /examples/plot_otda_mapping.py
parentec67362de5ec785e3871eac75a8aa477857092c4 (diff)
update tests
Diffstat (limited to 'examples/plot_otda_mapping.py')
-rw-r--r--examples/plot_otda_mapping.py27
1 files changed, 13 insertions, 14 deletions
diff --git a/examples/plot_otda_mapping.py b/examples/plot_otda_mapping.py
index 09d2cb4..e0da2d8 100644
--- a/examples/plot_otda_mapping.py
+++ b/examples/plot_otda_mapping.py
@@ -6,7 +6,7 @@ OT mapping estimation for domain adaptation [8]
This example presents how to use MappingTransport to estimate at the same
time both the coupling transport and approximate the transport map with either
-a linear or a kernelized mapping as introduced in [8]
+a linear or a kernelized mapping as introduced in [8].
[8] M. Perrot, N. Courty, R. Flamary, A. Habrard,
"Mapping estimation for discrete optimal transport",
@@ -43,6 +43,17 @@ Xt, yt = ot.datasets.get_data_classif(
Xt[yt == 2] *= 3
Xt = Xt + 4
+##############################################################################
+# plot data
+##############################################################################
+
+pl.figure(1, (10, 5))
+pl.clf()
+pl.scatter(Xs[:, 0], Xs[:, 1], c=ys, marker='+', label='Source samples')
+pl.scatter(Xt[:, 0], Xt[:, 1], c=yt, marker='o', label='Target samples')
+pl.legend(loc=0)
+pl.title('Source and target distributions')
+
##############################################################################
# Instantiate the different transport algorithms and fit them
@@ -76,19 +87,7 @@ transp_Xs_gaussian_new = ot_mapping_gaussian.transform(Xs=Xs_new)
##############################################################################
-# plot data
-##############################################################################
-
-pl.figure(1, (10, 5))
-pl.clf()
-pl.scatter(Xs[:, 0], Xs[:, 1], c=ys, marker='+', label='Source samples')
-pl.scatter(Xt[:, 0], Xt[:, 1], c=yt, marker='o', label='Target samples')
-pl.legend(loc=0)
-pl.title('Source and target distributions')
-
-
-##############################################################################
-# plot transported samples
+# Plot transported samples
##############################################################################
pl.figure(2)