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

Function test_nearest_brenier_potential_fit

test/test_mapping.py:29–39  ·  view source on GitHub ↗
(nx)

Source from the content-addressed store, hash-verified

27
28@pytest.mark.skipif(nocvxpy, reason="No CVXPY available")
29def test_nearest_brenier_potential_fit(nx):
30 X = nx.ones((2, 2))
31 phi, G, log = ot.mapping.nearest_brenier_potential_fit(X, X, its=3, log=True)
32 np.testing.assert_almost_equal(
33 to_numpy(G), to_numpy(X)
34 ) # image of source should be close to target
35 # test without log but with X_classes, a, b and other init method
36 a = nx.ones(2) / 2
37 ot.mapping.nearest_brenier_potential_fit(
38 X, X, X_classes=nx.ones(2), a=a, b=a, its=1, init_method="target"
39 )
40
41
42@pytest.mark.skipif(nocvxpy, reason="No CVXPY available")

Callers

nothing calls this directly

Calls 2

to_numpyFunction · 0.90
onesMethod · 0.45

Tested by

no test coverage detected