示例#1
0
 def testKernelRegressionGram(self):
     n, d = 100, 20
     xs = self.rng.normal(size=(n, d))
     kernel = lambda x, y: jnp.dot(x, y)
     np.testing.assert_allclose(kernel_lsq.gram(kernel, xs),
                                jnp.dot(xs, xs.T),
                                atol=1E-5)
示例#2
0
 def testKernelRegressionGram(self):
     n, d = 100, 20
     rng = onp.random.RandomState(0)
     truth = rng.randn(d)
     xs = rng.randn(n, d)
     ys = np.dot(xs, truth)
     kernel = lambda x, y: np.dot(x, y)
     assert np.all(kernel_lsq.gram(kernel, xs) == np.dot(xs, xs.T))
示例#3
0
 def testKernelRegressionGram(self):
     n, d = 100, 20
     rng = np.random.RandomState(0)
     xs = rng.randn(n, d)
     kernel = lambda x, y: jnp.dot(x, y)
     self.assertAllClose(kernel_lsq.gram(kernel, xs),
                         jnp.dot(xs, xs.T),
                         check_dtypes=False)