summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorRémi Flamary <remi.flamary@gmail.com>2018-09-28 16:04:19 +0200
committerRémi Flamary <remi.flamary@gmail.com>2018-09-28 16:04:19 +0200
commit642fd5b7707c4bdce72b883c666ffdae89fde76a (patch)
treef41f9896df48802a1b0457904fadec53c158c9c6 /test
parenteaa05d1411cc8b365479fb239acf4e774c68037c (diff)
speedup tests
Diffstat (limited to 'test')
-rw-r--r--test/test_bregman.py4
-rw-r--r--test/test_gromov.py10
-rw-r--r--test/test_ot.py12
-rw-r--r--test/test_utils.py2
4 files changed, 15 insertions, 13 deletions
diff --git a/test/test_bregman.py b/test/test_bregman.py
index b0c3358..14edaf5 100644
--- a/test/test_bregman.py
+++ b/test/test_bregman.py
@@ -118,12 +118,12 @@ def test_wasserstein_bary_2d():
a2 += a2.min()
a2 = a2 / np.sum(a2)
# creating matrix A containing all distributions
- A = np.zeros((2, 100, 100))
+ A = np.zeros((2, size, size))
A[0, :, :] = a1
A[1, :, :] = a2
# wasserstein
- reg = 1e-3
+ reg = 1e-2
bary_wass = ot.bregman.convolutional_barycenter2d(A, reg)
np.testing.assert_allclose(1, np.sum(bary_wass))
diff --git a/test/test_gromov.py b/test/test_gromov.py
index fb86274..305ae84 100644
--- a/test/test_gromov.py
+++ b/test/test_gromov.py
@@ -28,7 +28,7 @@ def test_gromov():
C1 /= C1.max()
C2 /= C2.max()
- G = ot.gromov.gromov_wasserstein(C1, C2, p, q, 'square_loss')
+ G = ot.gromov.gromov_wasserstein(C1, C2, p, q, 'square_loss', verbose=True)
# check constratints
np.testing.assert_allclose(
@@ -69,7 +69,7 @@ def test_entropic_gromov():
C2 /= C2.max()
G = ot.gromov.entropic_gromov_wasserstein(
- C1, C2, p, q, 'square_loss', epsilon=5e-4)
+ C1, C2, p, q, 'square_loss', epsilon=5e-4, verbose=True)
# check constratints
np.testing.assert_allclose(
@@ -107,7 +107,8 @@ def test_gromov_barycenter():
[ot.unif(ns), ot.unif(nt)
], ot.unif(n_samples), [.5, .5],
'square_loss', # 5e-4,
- max_iter=100, tol=1e-3)
+ max_iter=100, tol=1e-3,
+ verbose=True)
np.testing.assert_allclose(Cb.shape, (n_samples, n_samples))
Cb2 = ot.gromov.gromov_barycenters(n_samples, [C1, C2],
@@ -134,7 +135,8 @@ def test_gromov_entropic_barycenter():
[ot.unif(ns), ot.unif(nt)
], ot.unif(n_samples), [.5, .5],
'square_loss', 2e-3,
- max_iter=100, tol=1e-3)
+ max_iter=100, tol=1e-3,
+ verbose=True)
np.testing.assert_allclose(Cb.shape, (n_samples, n_samples))
Cb2 = ot.gromov.entropic_gromov_barycenters(n_samples, [C1, C2],
diff --git a/test/test_ot.py b/test/test_ot.py
index 45e777a..7652394 100644
--- a/test/test_ot.py
+++ b/test/test_ot.py
@@ -70,7 +70,7 @@ def test_emd_empty():
def test_emd2_multi():
- n = 1000 # nb bins
+ n = 500 # nb bins
# bin positions
x = np.arange(n, dtype=np.float64)
@@ -78,7 +78,7 @@ def test_emd2_multi():
# Gaussian distributions
a = gauss(n, m=20, s=5) # m= mean, s= std
- ls = np.arange(20, 1000, 20)
+ ls = np.arange(20, 500, 20)
nb = len(ls)
b = np.zeros((n, nb))
for i in range(nb):
@@ -207,11 +207,11 @@ def test_warnings():
def test_dual_variables():
- n = 5000 # nb bins
- m = 6000 # nb bins
+ n = 500 # nb bins
+ m = 600 # nb bins
- mean1 = 1000
- mean2 = 1100
+ mean1 = 300
+ mean2 = 400
# bin positions
x = np.arange(n, dtype=np.float64)
diff --git a/test/test_utils.py b/test/test_utils.py
index b524ef6..640598d 100644
--- a/test/test_utils.py
+++ b/test/test_utils.py
@@ -12,7 +12,7 @@ import sys
def test_parmap():
- n = 100
+ n = 10
def f(i):
return 1.0 * i * i