MCPcopy Create free account
hub / github.com/PythonOT/POT / test_linear_gw_mapping_class

Function test_linear_gw_mapping_class

test/test_da.py:694–717  ·  view source on GitHub ↗
(nx)

Source from the content-addressed store, hash-verified

692@pytest.skip_backend("jax")
693@pytest.skip_backend("tf")
694def test_linear_gw_mapping_class(nx):
695 ns = 50
696 nt = 50
697
698 Xs, ys = make_data_classif("3gauss", ns)
699 Xt, yt = make_data_classif("3gauss2", nt)
700
701 Xsb, Xtb = nx.from_numpy(Xs, Xt)
702
703 for log in [True, False]:
704 otmap = ot.da.LinearGWTransport(log=log)
705
706 otmap.fit(Xs=Xsb, Xt=Xtb)
707 assert hasattr(otmap, "A_")
708 assert hasattr(otmap, "B_")
709 assert hasattr(otmap, "A1_")
710 assert hasattr(otmap, "B1_")
711
712 Xst = nx.to_numpy(otmap.transform(Xs=Xsb))
713
714 Ct = np.cov(Xt.T)
715 Cst = np.cov(Xst.T)
716
717 np.testing.assert_allclose(Ct, Cst, rtol=1e-2, atol=1e-2)
718
719
720@pytest.skip_backend("jax")

Callers

nothing calls this directly

Calls 5

fitMethod · 0.95
make_data_classifFunction · 0.90
from_numpyMethod · 0.80
to_numpyMethod · 0.80
transformMethod · 0.45

Tested by

no test coverage detected