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

Function test_gmm_ot_plan_density

test/test_gmm.py:182–196  ·  view source on GitHub ↗
(nx)

Source from the content-addressed store, hash-verified

180
181
182def test_gmm_ot_plan_density(nx):
183 m_s, m_t, C_s, C_t, w_s, w_t = get_gmms(nx)
184 rng = np.random.RandomState(seed=42)
185 n = 7
186 x = nx.from_numpy(rng.randn(n, 3))
187 y = nx.from_numpy(rng.randn(n + 1, 3))
188
189 density = gmm_ot_plan_density(x, y, m_s, m_t, C_s, C_t, w_s, w_t)
190 assert density.shape == (n, n + 1)
191
192 plan = gmm_ot_plan(m_s, m_t, C_s, C_t, w_s, w_t)
193 gmm_ot_plan_density(x, x, m_s, m_t, C_s, C_t, w_s, w_t, plan=plan)
194
195 with pytest.raises(AssertionError):
196 gmm_ot_plan_density(x[:, 1:], y, m_s, m_t, C_s, C_t, w_s, w_t)
197
198
199@pytest.skip_backend("tf") # skips because of array assignment

Callers

nothing calls this directly

Calls 5

gmm_ot_plan_densityFunction · 0.90
gmm_ot_planFunction · 0.90
get_gmmsFunction · 0.85
from_numpyMethod · 0.80
randnMethod · 0.45

Tested by

no test coverage detected