Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 219dca1

Browse files
Circle CICircle CI
Circle CI
authored and
Circle CI
committed
CircleCI update of dev docs (2888).
1 parent 3686dde commit 219dca1

File tree

497 files changed

+753414
-742591
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

497 files changed

+753414
-742591
lines changed

master/_downloads/006964755fe89c4eeb7c8b8016e96890/plot_otda_semi_supervised.py

Lines changed: 35 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
============================================
66
77
This example introduces a semi supervised domain adaptation in a 2D setting.
8-
It explicits the problem of semi supervised domain adaptation and introduces
8+
It explicit the problem of semi supervised domain adaptation and introduces
99
some optimal transport approaches to solve it.
1010
1111
Quantities such as optimal couplings, greater coupling coefficients and
@@ -31,8 +31,8 @@
3131
n_samples_source = 150
3232
n_samples_target = 150
3333

34-
Xs, ys = ot.datasets.make_data_classif('3gauss', n_samples_source)
35-
Xt, yt = ot.datasets.make_data_classif('3gauss2', n_samples_target)
34+
Xs, ys = ot.datasets.make_data_classif("3gauss", n_samples_source)
35+
Xt, yt = ot.datasets.make_data_classif("3gauss2", n_samples_target)
3636

3737

3838
##############################################################################
@@ -69,30 +69,30 @@
6969

7070
pl.figure(1, figsize=(10, 10))
7171
pl.subplot(2, 2, 1)
72-
pl.scatter(Xs[:, 0], Xs[:, 1], c=ys, marker='+', label='Source samples')
72+
pl.scatter(Xs[:, 0], Xs[:, 1], c=ys, marker="+", label="Source samples")
7373
pl.xticks([])
7474
pl.yticks([])
7575
pl.legend(loc=0)
76-
pl.title('Source samples')
76+
pl.title("Source samples")
7777

7878
pl.subplot(2, 2, 2)
79-
pl.scatter(Xt[:, 0], Xt[:, 1], c=yt, marker='o', label='Target samples')
79+
pl.scatter(Xt[:, 0], Xt[:, 1], c=yt, marker="o", label="Target samples")
8080
pl.xticks([])
8181
pl.yticks([])
8282
pl.legend(loc=0)
83-
pl.title('Target samples')
83+
pl.title("Target samples")
8484

8585
pl.subplot(2, 2, 3)
86-
pl.imshow(ot_sinkhorn_un.cost_, interpolation='nearest')
86+
pl.imshow(ot_sinkhorn_un.cost_, interpolation="nearest")
8787
pl.xticks([])
8888
pl.yticks([])
89-
pl.title('Cost matrix - unsupervised DA')
89+
pl.title("Cost matrix - unsupervised DA")
9090

9191
pl.subplot(2, 2, 4)
92-
pl.imshow(ot_sinkhorn_semi.cost_, interpolation='nearest')
92+
pl.imshow(ot_sinkhorn_semi.cost_, interpolation="nearest")
9393
pl.xticks([])
9494
pl.yticks([])
95-
pl.title('Cost matrix - semi-supervised DA')
95+
pl.title("Cost matrix - semi-supervised DA")
9696

9797
pl.tight_layout()
9898

@@ -107,16 +107,16 @@
107107
pl.figure(2, figsize=(8, 4))
108108

109109
pl.subplot(1, 2, 1)
110-
pl.imshow(ot_sinkhorn_un.coupling_, interpolation='nearest')
110+
pl.imshow(ot_sinkhorn_un.coupling_, interpolation="nearest")
111111
pl.xticks([])
112112
pl.yticks([])
113-
pl.title('Optimal coupling\nUnsupervised DA')
113+
pl.title("Optimal coupling\nUnsupervised DA")
114114

115115
pl.subplot(1, 2, 2)
116-
pl.imshow(ot_sinkhorn_semi.coupling_, interpolation='nearest')
116+
pl.imshow(ot_sinkhorn_semi.coupling_, interpolation="nearest")
117117
pl.xticks([])
118118
pl.yticks([])
119-
pl.title('Optimal coupling\nSemi-supervised DA')
119+
pl.title("Optimal coupling\nSemi-supervised DA")
120120

121121
pl.tight_layout()
122122

@@ -128,21 +128,31 @@
128128
# display transported samples
129129
pl.figure(4, figsize=(8, 4))
130130
pl.subplot(1, 2, 1)
131-
pl.scatter(Xt[:, 0], Xt[:, 1], c=yt, marker='o',
132-
label='Target samples', alpha=0.5)
133-
pl.scatter(transp_Xs_sinkhorn_un[:, 0], transp_Xs_sinkhorn_un[:, 1], c=ys,
134-
marker='+', label='Transp samples', s=30)
135-
pl.title('Transported samples\nEmdTransport')
131+
pl.scatter(Xt[:, 0], Xt[:, 1], c=yt, marker="o", label="Target samples", alpha=0.5)
132+
pl.scatter(
133+
transp_Xs_sinkhorn_un[:, 0],
134+
transp_Xs_sinkhorn_un[:, 1],
135+
c=ys,
136+
marker="+",
137+
label="Transp samples",
138+
s=30,
139+
)
140+
pl.title("Transported samples\nEmdTransport")
136141
pl.legend(loc=0)
137142
pl.xticks([])
138143
pl.yticks([])
139144

140145
pl.subplot(1, 2, 2)
141-
pl.scatter(Xt[:, 0], Xt[:, 1], c=yt, marker='o',
142-
label='Target samples', alpha=0.5)
143-
pl.scatter(transp_Xs_sinkhorn_semi[:, 0], transp_Xs_sinkhorn_semi[:, 1], c=ys,
144-
marker='+', label='Transp samples', s=30)
145-
pl.title('Transported samples\nSinkhornTransport')
146+
pl.scatter(Xt[:, 0], Xt[:, 1], c=yt, marker="o", label="Target samples", alpha=0.5)
147+
pl.scatter(
148+
transp_Xs_sinkhorn_semi[:, 0],
149+
transp_Xs_sinkhorn_semi[:, 1],
150+
c=ys,
151+
marker="+",
152+
label="Transp samples",
153+
s=30,
154+
)
155+
pl.title("Transported samples\nSinkhornTransport")
146156
pl.xticks([])
147157
pl.yticks([])
148158

0 commit comments

Comments
 (0)