diff options
author | Rémi Flamary <remi.flamary@gmail.com> | 2018-03-21 10:32:18 +0100 |
---|---|---|
committer | Rémi Flamary <remi.flamary@gmail.com> | 2018-03-21 10:32:18 +0100 |
commit | 63fd11e8bfd45b163b313c7ad874ef608587fb68 (patch) | |
tree | 3c41c46c34baff08f4089092ada1c5a785ac8bb0 /test/test_gromov.py | |
parent | 7095e03eb339bcf32d91c5a8857ecc3f3d0c45c0 (diff) |
add entropic gromov test for 90+% corerage
Diffstat (limited to 'test/test_gromov.py')
-rw-r--r-- | test/test_gromov.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/test/test_gromov.py b/test/test_gromov.py index d865380..bb23469 100644 --- a/test/test_gromov.py +++ b/test/test_gromov.py @@ -116,3 +116,30 @@ def test_gromov_barycenter(): 'kl_loss', # 5e-4,
max_iter=100, tol=1e-3)
np.testing.assert_allclose(Cb2.shape, (n_samples, n_samples))
+
+
+def test_gromov_entropic_barycenter():
+
+ ns = 50
+ nt = 60
+
+ Xs, ys = ot.datasets.get_data_classif('3gauss', ns)
+ Xt, yt = ot.datasets.get_data_classif('3gauss2', nt)
+
+ C1 = ot.dist(Xs)
+ C2 = ot.dist(Xt)
+
+ n_samples = 3
+ Cb = ot.gromov.entropic_gromov_barycenters(n_samples, [C1, C2],
+ [ot.unif(ns), ot.unif(nt)
+ ], ot.unif(n_samples), [.5, .5],
+ 'square_loss', 1e-3,
+ max_iter=100, tol=1e-3)
+ np.testing.assert_allclose(Cb.shape, (n_samples, n_samples))
+
+ Cb2 = ot.gromov.entropic_gromov_barycenters(n_samples, [C1, C2],
+ [ot.unif(ns), ot.unif(nt)
+ ], ot.unif(n_samples), [.5, .5],
+ 'kl_loss', 1e-3,
+ max_iter=100, tol=1e-3)
+ np.testing.assert_allclose(Cb2.shape, (n_samples, n_samples))
|