Пример #1
0
 def test_compute_fmap(self):
     np.random.seed(42)
     fm = FeatureMap(distr='laplace',
                     bias=np.ones((1, 3)),
                     input_dim=2,
                     n_features=3,
                     params=[0.8, 2.3],
                     sigma_f=0.9)
     inputs = np.random.uniform(size=(5, 2))
     fmap = fm.compute_fmap(inputs=inputs)
     true_value = np.array([[0.70465845, 0.44404558, 0.55780791],
                            [0.87857849, -0.95074097, 0.54437667],
                            [0.45910944, 0.24313274, 0.89833969],
                            [0.84035852, 1.02257209, 0.95970943],
                            [-0.62313605, -0.58107188, 0.57497268]])
     np.testing.assert_array_almost_equal(true_value, fmap)
Пример #2
0
 def test_compute_fmap(self):
     np.random.seed(42)
     fm = FeatureMap(distr='laplace',
                     bias=np.ones((1, 3)),
                     input_dim=2,
                     n_features=3,
                     params=[0.8, 2.3],
                     sigma_f=0.9)
     inputs = np.random.uniform(size=(5, 2))
     fmap = fm.compute_fmap(inputs=inputs)
     true_value = np.array([[-0.42149623, 0.57314349, 0.73325259],
                            [0.65251962, 0.2455743, 0.73290642],
                            [0.42591728, 0.37857758, 0.53838879],
                            [-0.6921959, 0.65932346, 0.71051842],
                            [0.3605913, 0.37159967, 0.73375339]])
     np.testing.assert_array_almost_equal(true_value, fmap)