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

Function test_nystroem_kernel_approx

test/test_lowrank.py:14–24  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

12
13
14def test_nystroem_kernel_approx():
15 # test nystroem kernel approx in easy regime (nb anchors = nb points)
16 n = 30
17 d = 3
18 Xs = np.random.randn(n, d)
19 Xt = np.random.randn(n, d) + 2
20 sigma = 2.0
21 K = np.exp(-ot.dist(Xs, Xt) / (2 * sigma**2))
22 U, V = ot.lowrank.kernel_nystroem(Xs, Xt, anchors=60, sigma=sigma, random_state=42)
23
24 np.testing.assert_allclose(K, U @ V.T, atol=1e-7)
25
26
27@pytest.mark.parametrize("log, warn", [[False, False], [True, True]])

Callers

nothing calls this directly

Calls 2

randnMethod · 0.45
expMethod · 0.45

Tested by

no test coverage detected