summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorAlexandre Gramfort <alexandre.gramfort@m4x.org>2017-07-20 15:39:50 +0200
committerAlexandre Gramfort <alexandre.gramfort@m4x.org>2017-07-20 15:39:50 +0200
commit6ada23e5a672b08f28e21123c4135bc787e83b19 (patch)
treed9c2a307ac18b78801ef0bac6526332e41f15eb5 /examples
parentced35d10cb9c92e3cfd98f16f2fee778a969de97 (diff)
pep8
Diffstat (limited to 'examples')
-rw-r--r--examples/plot_OTDA_color_images.py2
-rw-r--r--examples/plot_OTDA_mapping_color_images.py2
-rw-r--r--examples/plot_optim_OTreg.py3
3 files changed, 7 insertions, 0 deletions
diff --git a/examples/plot_OTDA_color_images.py b/examples/plot_OTDA_color_images.py
index a8861c6..75ac5b6 100644
--- a/examples/plot_OTDA_color_images.py
+++ b/examples/plot_OTDA_color_images.py
@@ -48,6 +48,7 @@ def mat2im(X, shape):
"""Converts back a matrix to an image"""
return X.reshape(shape)
+
X1 = im2mat(I1)
X2 = im2mat(I2)
@@ -102,6 +103,7 @@ X2te = da_entrop.predict(X2, -1)
def minmax(I):
return np.clip(I, 0, 1)
+
I1t = minmax(mat2im(X1t, I1.shape))
I2t = minmax(mat2im(X2t, I2.shape))
diff --git a/examples/plot_OTDA_mapping_color_images.py b/examples/plot_OTDA_mapping_color_images.py
index 85c4b6b..9710461 100644
--- a/examples/plot_OTDA_mapping_color_images.py
+++ b/examples/plot_OTDA_mapping_color_images.py
@@ -48,6 +48,7 @@ def mat2im(X, shape):
"""Converts back a matrix to an image"""
return X.reshape(shape)
+
X1 = im2mat(I1)
X2 = im2mat(I2)
@@ -85,6 +86,7 @@ pl.tight_layout()
def minmax(I):
return np.clip(I, 0, 1)
+
# LP problem
da_emd = ot.da.OTDA() # init class
da_emd.fit(xs, xt) # fit distributions
diff --git a/examples/plot_optim_OTreg.py b/examples/plot_optim_OTreg.py
index e38253c..276b250 100644
--- a/examples/plot_optim_OTreg.py
+++ b/examples/plot_optim_OTreg.py
@@ -44,6 +44,7 @@ def f(G):
def df(G):
return G
+
reg = 1e-1
Gl2 = ot.optim.cg(a, b, M, reg, f, df, verbose=True)
@@ -61,6 +62,7 @@ def f(G):
def df(G):
return np.log(G) + 1.
+
reg = 1e-3
Ge = ot.optim.cg(a, b, M, reg, f, df, verbose=True)
@@ -78,6 +80,7 @@ def f(G):
def df(G):
return G
+
reg1 = 1e-3
reg2 = 1e-1