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

Function test_sliced_same_proj

test/test_sliced.py:113–126  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

111
112
113def test_sliced_same_proj():
114 n_projections = 10
115 seed = 12
116 rng = np.random.RandomState(0)
117 X = rng.randn(8, 2)
118 Y = rng.randn(8, 2)
119 cost1, log1 = ot.sliced_wasserstein_distance(
120 X, Y, seed=seed, n_projections=n_projections, log=True
121 )
122 P = get_random_projections(X.shape[1], n_projections=10, seed=seed)
123 cost2, log2 = ot.sliced_wasserstein_distance(X, Y, projections=P, log=True)
124
125 assert np.allclose(log1["projections"], log2["projections"])
126 assert np.isclose(cost1, cost2)
127
128
129def test_sliced_backend(nx):

Callers

nothing calls this directly

Calls 3

get_random_projectionsFunction · 0.90
randnMethod · 0.45
allcloseMethod · 0.45

Tested by

no test coverage detected