def test_io_2(self): can1_post = 0.8 can2_post = 0.2 cur_post = 0.1 can_z1 = np.random.random_sample((3, )) can_z2 = np.random.random_sample((3, )) z = np.random.random_sample((3, )) varS1 = dram.initialize_cov(None, 3) R2 = dram.stage2_acceptprob(can1_post, can2_post, cur_post, can_z1, can_z2, z, varS1) self.assertTrue(isinstance(R2, float), msg='Expect float return')
def test_poor_user_defined(self): initCov = np.random.random_sample(size=(3, 3)) with self.assertRaises(ValueError): dram.initialize_cov(initCov=initCov, q=4) initCov = np.random.random_sample(size=(4, 3)) with self.assertRaises(ValueError): dram.initialize_cov(initCov=initCov, q=4) initCov = np.random.random_sample(size=(3, 4)) with self.assertRaises(ValueError): dram.initialize_cov(initCov=initCov, q=4)
def test_user_defined(self): initCov = np.random.random_sample(size=(3, 3)) varS1 = dram.initialize_cov(initCov=initCov, q=3) self.assertEqual(varS1.shape, (3, 3), msg='Expect (3, 3)') self.assertTrue(np.array_equal(varS1, initCov), msg='Expect arrays equal')
def test_io(self): varS1 = dram.initialize_cov(None, q=3) self.assertEqual(varS1.shape, (3, 3), msg='Expect (3, 3)') self.assertEqual(list(np.diag(varS1)), [0.05, 0.05, 0.05], msg='Expect 0.05 along main diagonal')