Skip to content

Commit 6ada23e

Browse files
committed
pep8
1 parent ced35d1 commit 6ada23e

File tree

5 files changed

+12
-2
lines changed

5 files changed

+12
-2
lines changed

examples/plot_OTDA_color_images.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ def mat2im(X, shape):
4848
"""Converts back a matrix to an image"""
4949
return X.reshape(shape)
5050

51+
5152
X1 = im2mat(I1)
5253
X2 = im2mat(I2)
5354

@@ -102,6 +103,7 @@ def mat2im(X, shape):
102103
def minmax(I):
103104
return np.clip(I, 0, 1)
104105

106+
105107
I1t = minmax(mat2im(X1t, I1.shape))
106108
I2t = minmax(mat2im(X2t, I2.shape))
107109

examples/plot_OTDA_mapping_color_images.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ def mat2im(X, shape):
4848
"""Converts back a matrix to an image"""
4949
return X.reshape(shape)
5050

51+
5152
X1 = im2mat(I1)
5253
X2 = im2mat(I2)
5354

@@ -85,6 +86,7 @@ def mat2im(X, shape):
8586
def minmax(I):
8687
return np.clip(I, 0, 1)
8788

89+
8890
# LP problem
8991
da_emd = ot.da.OTDA() # init class
9092
da_emd.fit(xs, xt) # fit distributions

examples/plot_optim_OTreg.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ def f(G):
4444
def df(G):
4545
return G
4646

47+
4748
reg = 1e-1
4849

4950
Gl2 = ot.optim.cg(a, b, M, reg, f, df, verbose=True)
@@ -61,6 +62,7 @@ def f(G):
6162
def df(G):
6263
return np.log(G) + 1.
6364

65+
6466
reg = 1e-3
6567

6668
Ge = ot.optim.cg(a, b, M, reg, f, df, verbose=True)
@@ -78,6 +80,7 @@ def f(G):
7880
def df(G):
7981
return G
8082

83+
8184
reg1 = 1e-3
8285
reg2 = 1e-1
8386

ot/utils.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@
22
"""
33
Various function that can be usefull
44
"""
5+
import multiprocessing
6+
from functools import reduce
7+
import time
8+
59
import numpy as np
610
from scipy.spatial.distance import cdist
7-
import multiprocessing
811

9-
import time
1012
__time_tic_toc = time.time()
1113

1214

test/test_gpu_sinkhorn_lpl1.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ def describeRes(r):
88
print("min:{:.3E}, max:{:.3E}, mean:{:.3E}, std:{:.3E}"
99
.format(np.min(r), np.max(r), np.mean(r), np.std(r)))
1010

11+
1112
for n in [5000, 10000, 15000, 20000]:
1213
print(n)
1314
a = np.random.rand(n // 4, 100)

0 commit comments

Comments
 (0)