From 4a585de94109102c89bcd7ad43e35772e1027cd2 Mon Sep 17 00:00:00 2001 From: Rémi Flamary Date: Fri, 16 Feb 2018 11:58:59 +0100 Subject: update examples --- examples/plot_gromov_barycenter.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'examples/plot_gromov_barycenter.py') diff --git a/examples/plot_gromov_barycenter.py b/examples/plot_gromov_barycenter.py index 180b0cf..fde822b 100755 --- a/examples/plot_gromov_barycenter.py +++ b/examples/plot_gromov_barycenter.py @@ -132,28 +132,28 @@ Ct01 = [0 for i in range(2)] for i in range(2): Ct01[i] = ot.gromov.gromov_barycenters(n_samples, [Cs[0], Cs[1]], [ps[0], ps[1] - ], p, lambdast[i], 'square_loss', 5e-4, + ], p, lambdast[i], 'square_loss', #5e-4, max_iter=100, tol=1e-3) Ct02 = [0 for i in range(2)] for i in range(2): Ct02[i] = ot.gromov.gromov_barycenters(n_samples, [Cs[0], Cs[2]], [ps[0], ps[2] - ], p, lambdast[i], 'square_loss', 5e-4, + ], p, lambdast[i], 'square_loss',# 5e-4, max_iter=100, tol=1e-3) Ct13 = [0 for i in range(2)] for i in range(2): Ct13[i] = ot.gromov.gromov_barycenters(n_samples, [Cs[1], Cs[3]], [ps[1], ps[3] - ], p, lambdast[i], 'square_loss', 5e-4, + ], p, lambdast[i], 'square_loss',# 5e-4, max_iter=100, tol=1e-3) Ct23 = [0 for i in range(2)] for i in range(2): Ct23[i] = ot.gromov.gromov_barycenters(n_samples, [Cs[2], Cs[3]], [ps[2], ps[3] - ], p, lambdast[i], 'square_loss', 5e-4, + ], p, lambdast[i], 'square_loss', #5e-4, max_iter=100, tol=1e-3) -- cgit v1.2.3 From d41ffdb24de5cb234237482b3f332b06514b10f0 Mon Sep 17 00:00:00 2001 From: Rémi Flamary Date: Fri, 16 Feb 2018 14:04:28 +0100 Subject: no more pep8 problem, need cleanup plots in test and examples --- examples/plot_gromov_barycenter.py | 8 ++++---- ot/da.py | 20 ++++++++++---------- 2 files changed, 14 insertions(+), 14 deletions(-) (limited to 'examples/plot_gromov_barycenter.py') diff --git a/examples/plot_gromov_barycenter.py b/examples/plot_gromov_barycenter.py index fde822b..58fc51a 100755 --- a/examples/plot_gromov_barycenter.py +++ b/examples/plot_gromov_barycenter.py @@ -132,28 +132,28 @@ Ct01 = [0 for i in range(2)] for i in range(2): Ct01[i] = ot.gromov.gromov_barycenters(n_samples, [Cs[0], Cs[1]], [ps[0], ps[1] - ], p, lambdast[i], 'square_loss', #5e-4, + ], p, lambdast[i], 'square_loss', # 5e-4, max_iter=100, tol=1e-3) Ct02 = [0 for i in range(2)] for i in range(2): Ct02[i] = ot.gromov.gromov_barycenters(n_samples, [Cs[0], Cs[2]], [ps[0], ps[2] - ], p, lambdast[i], 'square_loss',# 5e-4, + ], p, lambdast[i], 'square_loss', # 5e-4, max_iter=100, tol=1e-3) Ct13 = [0 for i in range(2)] for i in range(2): Ct13[i] = ot.gromov.gromov_barycenters(n_samples, [Cs[1], Cs[3]], [ps[1], ps[3] - ], p, lambdast[i], 'square_loss',# 5e-4, + ], p, lambdast[i], 'square_loss', # 5e-4, max_iter=100, tol=1e-3) Ct23 = [0 for i in range(2)] for i in range(2): Ct23[i] = ot.gromov.gromov_barycenters(n_samples, [Cs[2], Cs[3]], [ps[2], ps[3] - ], p, lambdast[i], 'square_loss', #5e-4, + ], p, lambdast[i], 'square_loss', # 5e-4, max_iter=100, tol=1e-3) diff --git a/ot/da.py b/ot/da.py index ee73ec8..c688654 100644 --- a/ot/da.py +++ b/ot/da.py @@ -330,17 +330,17 @@ def joint_OT_mapping_linear(xs, xt, mu=1, eta=0.001, bias=False, verbose=False, if bias: xs1 = np.hstack((xs, np.ones((ns, 1)))) xstxs = xs1.T.dot(xs1) - I = np.eye(d + 1) - I[-1] = 0 - I0 = I[:, :-1] + Id = np.eye(d + 1) + Id[-1] = 0 + I0 = Id[:, :-1] def sel(x): return x[:-1, :] else: xs1 = xs xstxs = xs1.T.dot(xs1) - I = np.eye(d) - I0 = I + Id = np.eye(d) + I0 = Id def sel(x): return x @@ -361,7 +361,7 @@ def joint_OT_mapping_linear(xs, xt, mu=1, eta=0.001, bias=False, verbose=False, def solve_L(G): """ solve L problem with fixed G (least square)""" xst = ns * G.dot(xt) - return np.linalg.solve(xstxs + eta * I, xs1.T.dot(xst) + eta * I0) + return np.linalg.solve(xstxs + eta * Id, xs1.T.dot(xst) + eta * I0) def solve_G(L, G0): """Update G with CG algorithm""" @@ -520,8 +520,8 @@ def joint_OT_mapping_kernel(xs, xt, mu=1, eta=0.001, kerneltype='gaussian', K = kernel(xs, xs, method=kerneltype, sigma=sigma) if bias: K1 = np.hstack((K, np.ones((ns, 1)))) - I = np.eye(ns + 1) - I[-1] = 0 + Id = np.eye(ns + 1) + Id[-1] = 0 Kp = np.eye(ns + 1) Kp[:ns, :ns] = K @@ -535,14 +535,14 @@ def joint_OT_mapping_kernel(xs, xt, mu=1, eta=0.001, kerneltype='gaussian', else: K1 = K - I = np.eye(ns) + Id = np.eye(ns) # ls regul # K0 = K1.T.dot(K1)+eta*I # Kreg=I # proper kernel ridge - K0 = K + eta * I + K0 = K + eta * Id Kreg = K if log: -- cgit v1.2.3