summaryrefslogtreecommitdiff
path: root/test/test_stochastic.py
diff options
context:
space:
mode:
authorKilian Fatras <kilianfatras@Kilians-Air.hitronhub.home>2018-08-29 14:06:58 -0700
committerKilian Fatras <kilianfatras@Kilians-Air.hitronhub.home>2018-08-29 14:06:58 -0700
commitfd6371cc557ba73c4f5d1142fa8de8d956a850f0 (patch)
tree8e17e889c94ed915884484c24ec683648ec6d9e0 /test/test_stochastic.py
parentb2b5ffc529a7a3dbc51408cd2df59617a7e49a9a (diff)
replaced marginal tests
Diffstat (limited to 'test/test_stochastic.py')
-rw-r--r--test/test_stochastic.py27
1 files changed, 12 insertions, 15 deletions
diff --git a/test/test_stochastic.py b/test/test_stochastic.py
index 74228a3..0128317 100644
--- a/test/test_stochastic.py
+++ b/test/test_stochastic.py
@@ -97,7 +97,6 @@ def test_sag_asgd_sinkhorn():
x = rng.randn(n, 2)
u = ot.utils.unif(n)
- zero = np.zeros(n)
M = ot.dist(x, x)
G_asgd = ot.stochastic.solve_semi_dual_entropic(u, u, M, reg, "asgd",
@@ -108,13 +107,13 @@ def test_sag_asgd_sinkhorn():
# check constratints
np.testing.assert_allclose(
- zero, (G_sag - G_sinkhorn).sum(1), atol=1e-03) # cf convergence sag
+ G_sag.sum(1), G_sinkhorn.sum(1), atol=1e-03)
np.testing.assert_allclose(
- zero, (G_sag - G_sinkhorn).sum(0), atol=1e-03) # cf convergence sag
+ G_sag.sum(0), G_sinkhorn.sum(0), atol=1e-03)
np.testing.assert_allclose(
- zero, (G_asgd - G_sinkhorn).sum(1), atol=1e-03) # cf convergence asgd
+ G_asgd.sum(1), G_sinkhorn.sum(1), atol=1e-03)
np.testing.assert_allclose(
- zero, (G_asgd - G_sinkhorn).sum(0), atol=1e-03) # cf convergence asgd
+ G_asgd.sum(0), G_sinkhorn.sum(0), atol=1e-03)
np.testing.assert_allclose(
G_sag, G_sinkhorn, atol=1e-03) # cf convergence sag
np.testing.assert_allclose(
@@ -151,9 +150,9 @@ def test_stochastic_dual_sgd():
# check constratints
np.testing.assert_allclose(
- u, G.sum(1), atol=1e-04) # cf convergence sgd
+ u, G.sum(1), atol=1e-03) # cf convergence sgd
np.testing.assert_allclose(
- u, G.sum(0), atol=1e-04) # cf convergence sgd
+ u, G.sum(0), atol=1e-03) # cf convergence sgd
#############################################################################
@@ -175,7 +174,6 @@ def test_dual_sgd_sinkhorn():
# Test uniform
x = rng.randn(n, 2)
u = ot.utils.unif(n)
- zero = np.zeros(n)
M = ot.dist(x, x)
G_sgd = ot.stochastic.solve_dual_entropic(u, u, M, reg, batch_size,
@@ -185,17 +183,16 @@ def test_dual_sgd_sinkhorn():
# check constratints
np.testing.assert_allclose(
- zero, (G_sgd - G_sinkhorn).sum(1), atol=1e-04) # cf convergence sgd
+ G_sgd.sum(1), G_sinkhorn.sum(1), atol=1e-03)
np.testing.assert_allclose(
- zero, (G_sgd - G_sinkhorn).sum(0), atol=1e-04) # cf convergence sgd
+ G_sgd.sum(0), G_sinkhorn.sum(0), atol=1e-03)
np.testing.assert_allclose(
- G_sgd, G_sinkhorn, atol=1e-04) # cf convergence sgd
+ G_sgd, G_sinkhorn, atol=1e-03) # cf convergence sgd
# Test gaussian
n = 30
reg = 1
batch_size = 30
- zero = np.zeros(n)
a = ot.datasets.make_1D_gauss(n, 15, 5) # m= mean, s= std
b = ot.datasets.make_1D_gauss(n, 15, 5)
@@ -211,8 +208,8 @@ def test_dual_sgd_sinkhorn():
# check constratints
np.testing.assert_allclose(
- zero, (G_sgd - G_sinkhorn).sum(1), atol=1e-04) # cf convergence sgd
+ G_sgd.sum(1), G_sinkhorn.sum(1), atol=1e-03)
np.testing.assert_allclose(
- zero, (G_sgd - G_sinkhorn).sum(0), atol=1e-04) # cf convergence sgd
+ G_sgd.sum(0), G_sinkhorn.sum(0), atol=1e-03)
np.testing.assert_allclose(
- G_sgd, G_sinkhorn, atol=1e-04) # cf convergence sgd
+ G_sgd, G_sinkhorn, atol=1e-03) # cf convergence sgd