Exemplo n.º 1
0
 def test_noise(self,thr=1e-6):
     """ Test noise covariance.
     """
     n,m,D,X,Z = self.n,self.m,self.D,self.X,self.Z
     k = cov.noise()
     self.run_verifications(k,thr)
     d = np.linalg.norm( k(X) - np.eye(n) )
     self.assertLessEqual(d,thr)
     d = np.linalg.norm( k(X,Z) - np.eye(n,m) )
     self.assertLessEqual(d,thr)
Exemplo n.º 2
0
 def test_noise(self, thr=1e-6):
     """ Test noise covariance.
     """
     n, m, D, X, Z = self.n, self.m, self.D, self.X, self.Z
     k = cov.noise()
     self.run_verifications(k, thr)
     d = np.linalg.norm(k(X) - np.eye(n))
     self.assertLessEqual(d, thr)
     d = np.linalg.norm(k(X, Z) - np.eye(n, m))
     self.assertLessEqual(d, thr)
Exemplo n.º 3
0
def test_noise():
  '''
  Tests the noise covariance 
  WN :math:`=\sigma^2 \delta_{x,x^\prime}`
  '''
  f  = covs.noise(2.1)
  cov_train,cov_test = apply_cov(f)
  expect_cov_train = 4.41*np.eye(3)
  expect_cov_test = np.zeros((3,2))
  expect_cov_test[0][0]= 4.41
  np.testing.assert_almost_equal(cov_train, expect_cov_train)
  np.testing.assert_almost_equal(cov_test, expect_cov_test)