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

Function test_bregman_batch

test/batch/test_solve_batch.py:65–78  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

63
64
65def test_bregman_batch():
66 batchsize = 4
67 d = 2
68 n = 4
69 rng = np.random.RandomState(0)
70 X = rng.rand(batchsize, n, d)
71 M = dist_batch(X, X)
72 K = np.exp(-M / 0.01)
73 log_K = -M / 0.01
74 res = bregman_projection_batch(K, max_iter=50, tol=1e-10)
75 plan = res["T"]
76 res_log = bregman_log_projection_batch(log_K, max_iter=50, tol=1e-10)
77 plan_log = res_log["T"]
78 np.testing.assert_allclose(plan, plan_log, atol=1e-3)
79
80
81@pytest.mark.parametrize("metric", ["sqeuclidean", "euclidean", "minkowski", "kl"])

Callers

nothing calls this directly

Calls 5

dist_batchFunction · 0.90
bregman_projection_batchFunction · 0.90
randMethod · 0.45
expMethod · 0.45

Tested by

no test coverage detected