summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile5
-rw-r--r--test/test_da.py24
2 files changed, 29 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index 7e0c576..468d042 100644
--- a/Makefile
+++ b/Makefile
@@ -56,6 +56,11 @@ rdoc :
notebook :
ipython notebook --matplotlib=inline --notebook-dir=notebooks/
+
+autopep8 :
+ autopep8 -ir test ot examples
+aautopep8 :
+ autopep8 -air test ot examples
FORCE :
diff --git a/test/test_da.py b/test/test_da.py
index 7b63daf..a9d6d34 100644
--- a/test/test_da.py
+++ b/test/test_da.py
@@ -462,6 +462,30 @@ def test_linear_mapping():
np.testing.assert_allclose(Ct, Cst, rtol=1e-2, atol=1e-2)
+def test_linear_mapping_class():
+
+ ns = 150
+ nt = 200
+
+ Xs, ys = get_data_classif('3gauss', ns)
+ Xt, yt = get_data_classif('3gauss2', nt)
+
+ otmap = ot.da.LinearTransport()
+
+ otmap.fit(Xs=Xs, Xt=Xt)
+ assert hasattr(otmap, "A_")
+ assert hasattr(otmap, "B_")
+ assert hasattr(otmap, "A1_")
+ assert hasattr(otmap, "B1_")
+
+ Xst = otmap.transform(Xs=Xs)
+
+ Ct = np.cov(Xt.T)
+ 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