[MRG] Speedup tests by rflamary · Pull Request #262 · PythonOT/POT
Expand Up
@@ -30,7 +30,7 @@
def test_stochastic_sag(): # test sag n = 15 n = 10 reg = 1 numItermax = 30000 rng = np.random.RandomState(0) Expand All @@ -45,9 +45,9 @@ def test_stochastic_sag():
# check constratints np.testing.assert_allclose( u, G.sum(1), atol=1e-04) # cf convergence sag u, G.sum(1), atol=1e-03) # cf convergence sag np.testing.assert_allclose( u, G.sum(0), atol=1e-04) # cf convergence sag u, G.sum(0), atol=1e-03) # cf convergence sag
############################################################################# Expand All @@ -60,9 +60,9 @@ def test_stochastic_sag():
def test_stochastic_asgd(): # test asgd n = 15 n = 10 reg = 1 numItermax = 100000 numItermax = 10000 rng = np.random.RandomState(0)
x = rng.randn(n, 2) Expand All @@ -75,9 +75,9 @@ def test_stochastic_asgd():
# check constratints np.testing.assert_allclose( u, G.sum(1), atol=1e-03) # cf convergence asgd u, G.sum(1), atol=1e-02) # cf convergence asgd np.testing.assert_allclose( u, G.sum(0), atol=1e-03) # cf convergence asgd u, G.sum(0), atol=1e-02) # cf convergence asgd
############################################################################# Expand All @@ -90,9 +90,9 @@ def test_stochastic_asgd():
def test_sag_asgd_sinkhorn(): # test all algorithms n = 15 n = 10 reg = 1 nb_iter = 100000 nb_iter = 10000 rng = np.random.RandomState(0)
x = rng.randn(n, 2) Expand All @@ -107,17 +107,17 @@ def test_sag_asgd_sinkhorn():
# check constratints np.testing.assert_allclose( G_sag.sum(1), G_sinkhorn.sum(1), atol=1e-03) G_sag.sum(1), G_sinkhorn.sum(1), atol=1e-02) np.testing.assert_allclose( G_sag.sum(0), G_sinkhorn.sum(0), atol=1e-03) G_sag.sum(0), G_sinkhorn.sum(0), atol=1e-02) np.testing.assert_allclose( G_asgd.sum(1), G_sinkhorn.sum(1), atol=1e-03) G_asgd.sum(1), G_sinkhorn.sum(1), atol=1e-02) np.testing.assert_allclose( G_asgd.sum(0), G_sinkhorn.sum(0), atol=1e-03) G_asgd.sum(0), G_sinkhorn.sum(0), atol=1e-02) np.testing.assert_allclose( G_sag, G_sinkhorn, atol=1e-03) # cf convergence sag G_sag, G_sinkhorn, atol=1e-02) # cf convergence sag np.testing.assert_allclose( G_asgd, G_sinkhorn, atol=1e-03) # cf convergence asgd G_asgd, G_sinkhorn, atol=1e-02) # cf convergence asgd
############################################################################# Expand All @@ -136,7 +136,7 @@ def test_stochastic_dual_sgd(): # test sgd n = 10 reg = 1 numItermax = 15000 numItermax = 5000 batch_size = 10 rng = np.random.RandomState(0)
Expand Down Expand Up @@ -167,7 +167,7 @@ def test_dual_sgd_sinkhorn(): # test all dual algorithms n = 10 reg = 1 nb_iter = 15000 nb_iter = 5000 batch_size = 10 rng = np.random.RandomState(0)
Expand All @@ -183,11 +183,11 @@ def test_dual_sgd_sinkhorn():
# check constratints np.testing.assert_allclose( G_sgd.sum(1), G_sinkhorn.sum(1), atol=1e-03) G_sgd.sum(1), G_sinkhorn.sum(1), atol=1e-02) np.testing.assert_allclose( G_sgd.sum(0), G_sinkhorn.sum(0), atol=1e-03) G_sgd.sum(0), G_sinkhorn.sum(0), atol=1e-02) np.testing.assert_allclose( G_sgd, G_sinkhorn, atol=1e-03) # cf convergence sgd G_sgd, G_sinkhorn, atol=1e-02) # cf convergence sgd
# Test gaussian n = 30 Expand Down
def test_stochastic_sag(): # test sag n = 15 n = 10 reg = 1 numItermax = 30000 rng = np.random.RandomState(0) Expand All @@ -45,9 +45,9 @@ def test_stochastic_sag():
# check constratints np.testing.assert_allclose( u, G.sum(1), atol=1e-04) # cf convergence sag u, G.sum(1), atol=1e-03) # cf convergence sag np.testing.assert_allclose( u, G.sum(0), atol=1e-04) # cf convergence sag u, G.sum(0), atol=1e-03) # cf convergence sag
############################################################################# Expand All @@ -60,9 +60,9 @@ def test_stochastic_sag():
def test_stochastic_asgd(): # test asgd n = 15 n = 10 reg = 1 numItermax = 100000 numItermax = 10000 rng = np.random.RandomState(0)
x = rng.randn(n, 2) Expand All @@ -75,9 +75,9 @@ def test_stochastic_asgd():
# check constratints np.testing.assert_allclose( u, G.sum(1), atol=1e-03) # cf convergence asgd u, G.sum(1), atol=1e-02) # cf convergence asgd np.testing.assert_allclose( u, G.sum(0), atol=1e-03) # cf convergence asgd u, G.sum(0), atol=1e-02) # cf convergence asgd
############################################################################# Expand All @@ -90,9 +90,9 @@ def test_stochastic_asgd():
def test_sag_asgd_sinkhorn(): # test all algorithms n = 15 n = 10 reg = 1 nb_iter = 100000 nb_iter = 10000 rng = np.random.RandomState(0)
x = rng.randn(n, 2) Expand All @@ -107,17 +107,17 @@ def test_sag_asgd_sinkhorn():
# check constratints np.testing.assert_allclose( G_sag.sum(1), G_sinkhorn.sum(1), atol=1e-03) G_sag.sum(1), G_sinkhorn.sum(1), atol=1e-02) np.testing.assert_allclose( G_sag.sum(0), G_sinkhorn.sum(0), atol=1e-03) G_sag.sum(0), G_sinkhorn.sum(0), atol=1e-02) np.testing.assert_allclose( G_asgd.sum(1), G_sinkhorn.sum(1), atol=1e-03) G_asgd.sum(1), G_sinkhorn.sum(1), atol=1e-02) np.testing.assert_allclose( G_asgd.sum(0), G_sinkhorn.sum(0), atol=1e-03) G_asgd.sum(0), G_sinkhorn.sum(0), atol=1e-02) np.testing.assert_allclose( G_sag, G_sinkhorn, atol=1e-03) # cf convergence sag G_sag, G_sinkhorn, atol=1e-02) # cf convergence sag np.testing.assert_allclose( G_asgd, G_sinkhorn, atol=1e-03) # cf convergence asgd G_asgd, G_sinkhorn, atol=1e-02) # cf convergence asgd
############################################################################# Expand All @@ -136,7 +136,7 @@ def test_stochastic_dual_sgd(): # test sgd n = 10 reg = 1 numItermax = 15000 numItermax = 5000 batch_size = 10 rng = np.random.RandomState(0)
Expand Down Expand Up @@ -167,7 +167,7 @@ def test_dual_sgd_sinkhorn(): # test all dual algorithms n = 10 reg = 1 nb_iter = 15000 nb_iter = 5000 batch_size = 10 rng = np.random.RandomState(0)
Expand All @@ -183,11 +183,11 @@ def test_dual_sgd_sinkhorn():
# check constratints np.testing.assert_allclose( G_sgd.sum(1), G_sinkhorn.sum(1), atol=1e-03) G_sgd.sum(1), G_sinkhorn.sum(1), atol=1e-02) np.testing.assert_allclose( G_sgd.sum(0), G_sinkhorn.sum(0), atol=1e-03) G_sgd.sum(0), G_sinkhorn.sum(0), atol=1e-02) np.testing.assert_allclose( G_sgd, G_sinkhorn, atol=1e-03) # cf convergence sgd G_sgd, G_sinkhorn, atol=1e-02) # cf convergence sgd
# Test gaussian n = 30 Expand Down