From 4641ec5f2ddbff1a468afaf65741aecae44738cc Mon Sep 17 00:00:00 2001 From: Rémi Flamary Date: Tue, 29 May 2018 16:25:22 +0200 Subject: remove OTDA + pep8 --- test/test_da.py | 63 --------------------------------------------------------- 1 file changed, 63 deletions(-) (limited to 'test/test_da.py') diff --git a/test/test_da.py b/test/test_da.py index 3022721..dc8bc5f 100644 --- a/test/test_da.py +++ b/test/test_da.py @@ -484,66 +484,3 @@ def test_linear_mapping_class(): Cst = np.cov(Xst.T) np.testing.assert_allclose(Ct, Cst, rtol=1e-2, atol=1e-2) - - -def test_otda(): - - n_samples = 150 # nb samples - np.random.seed(0) - - xs, ys = ot.datasets.get_data_classif('3gauss', n_samples) - xt, yt = ot.datasets.get_data_classif('3gauss2', n_samples) - - a, b = ot.unif(n_samples), ot.unif(n_samples) - - # LP problem - da_emd = ot.da.OTDA() # init class - da_emd.fit(xs, xt) # fit distributions - da_emd.interp() # interpolation of source samples - da_emd.predict(xs) # interpolation of source samples - - np.testing.assert_allclose(a, np.sum(da_emd.G, 1)) - np.testing.assert_allclose(b, np.sum(da_emd.G, 0)) - - # sinkhorn regularization - lambd = 1e-1 - da_entrop = ot.da.OTDA_sinkhorn() - da_entrop.fit(xs, xt, reg=lambd) - da_entrop.interp() - da_entrop.predict(xs) - - np.testing.assert_allclose( - a, np.sum(da_entrop.G, 1), rtol=1e-3, atol=1e-3) - np.testing.assert_allclose(b, np.sum(da_entrop.G, 0), rtol=1e-3, atol=1e-3) - - # non-convex Group lasso regularization - reg = 1e-1 - eta = 1e0 - da_lpl1 = ot.da.OTDA_lpl1() - da_lpl1.fit(xs, ys, xt, reg=reg, eta=eta) - da_lpl1.interp() - da_lpl1.predict(xs) - - np.testing.assert_allclose(a, np.sum(da_lpl1.G, 1), rtol=1e-3, atol=1e-3) - np.testing.assert_allclose(b, np.sum(da_lpl1.G, 0), rtol=1e-3, atol=1e-3) - - # True Group lasso regularization - reg = 1e-1 - eta = 2e0 - da_l1l2 = ot.da.OTDA_l1l2() - da_l1l2.fit(xs, ys, xt, reg=reg, eta=eta, numItermax=20, verbose=True) - da_l1l2.interp() - da_l1l2.predict(xs) - - np.testing.assert_allclose(a, np.sum(da_l1l2.G, 1), rtol=1e-3, atol=1e-3) - np.testing.assert_allclose(b, np.sum(da_l1l2.G, 0), rtol=1e-3, atol=1e-3) - - # linear mapping - da_emd = ot.da.OTDA_mapping_linear() # init class - da_emd.fit(xs, xt, numItermax=10) # fit distributions - da_emd.predict(xs) # interpolation of source samples - - # nonlinear mapping - da_emd = ot.da.OTDA_mapping_kernel() # init class - da_emd.fit(xs, xt, numItermax=10) # fit distributions - da_emd.predict(xs) # interpolation of source samples -- cgit v1.2.3 From f5dcbc44cd5347be5c0a4039bf2350b3bdbd2cac Mon Sep 17 00:00:00 2001 From: Rémi Flamary Date: Mon, 11 Jun 2018 11:29:19 +0200 Subject: add new line for pep8 --- test/test_da.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/test_da.py') diff --git a/test/test_da.py b/test/test_da.py index b429315..f7f3a9d 100644 --- a/test/test_da.py +++ b/test/test_da.py @@ -483,4 +483,4 @@ def test_linear_mapping_class(): Ct = np.cov(Xt.T) Cst = np.cov(Xst.T) - np.testing.assert_allclose(Ct, Cst, rtol=1e-2, atol=1e-2) \ No newline at end of file + np.testing.assert_allclose(Ct, Cst, rtol=1e-2, atol=1e-2) -- cgit v1.2.3