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

Function test_brenier_potential_predict_bounds

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

Source from the content-addressed store, hash-verified

41
42@pytest.mark.skipif(nocvxpy, reason="No CVXPY available")
43def test_brenier_potential_predict_bounds(nx):
44 X = nx.ones((2, 2))
45 phi, G = ot.mapping.nearest_brenier_potential_fit(X, X, its=3)
46 phi_lu, G_lu, log = ot.mapping.nearest_brenier_potential_predict_bounds(
47 X, phi, G, X, log=True
48 )
49 # 'new' input isn't new, so should be equal to target
50 np.testing.assert_almost_equal(to_numpy(G_lu[0]), to_numpy(X))
51 np.testing.assert_almost_equal(to_numpy(G_lu[1]), to_numpy(X))
52 # test with no log but classes
53 ot.mapping.nearest_brenier_potential_predict_bounds(
54 X, phi, G, X, X_classes=nx.ones(2), Y_classes=nx.ones(2)
55 )
56
57
58def test_joint_OT_mapping():

Callers

nothing calls this directly

Calls 2

to_numpyFunction · 0.90
onesMethod · 0.45

Tested by

no test coverage detected