Skip to content

Commit 5efdf00

Browse files
committed
add test linear mapping class
1 parent 6fdf5de commit 5efdf00

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,11 @@ rdoc :
5656

5757
notebook :
5858
ipython notebook --matplotlib=inline --notebook-dir=notebooks/
59+
60+
autopep8 :
61+
autopep8 -ir test ot examples
5962

63+
aautopep8 :
64+
autopep8 -air test ot examples
6065

6166
FORCE :

test/test_da.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -462,6 +462,30 @@ def test_linear_mapping():
462462
np.testing.assert_allclose(Ct, Cst, rtol=1e-2, atol=1e-2)
463463

464464

465+
def test_linear_mapping_class():
466+
467+
ns = 150
468+
nt = 200
469+
470+
Xs, ys = get_data_classif('3gauss', ns)
471+
Xt, yt = get_data_classif('3gauss2', nt)
472+
473+
otmap = ot.da.LinearTransport()
474+
475+
otmap.fit(Xs=Xs, Xt=Xt)
476+
assert hasattr(otmap, "A_")
477+
assert hasattr(otmap, "B_")
478+
assert hasattr(otmap, "A1_")
479+
assert hasattr(otmap, "B1_")
480+
481+
Xst = otmap.transform(Xs=Xs)
482+
483+
Ct = np.cov(Xt.T)
484+
Cst = np.cov(Xst.T)
485+
486+
np.testing.assert_allclose(Ct, Cst, rtol=1e-2, atol=1e-2)
487+
488+
465489
def test_otda():
466490

467491
n_samples = 150 # nb samples

0 commit comments

Comments
 (0)