示例#1
0
 def test_subsample_power_interval_error(self):
     with self.assertRaises(ValueError):
         subsample_power(self.f,
                         samples=[np.ones((3)), np.ones((5))],
                         min_observations=2,
                         min_counts=5,
                         counts_interval=1000,
                         max_counts=7)
示例#2
0
 def test_subsample_power_multi_p(self):
     test_p, test_c = subsample_power(lambda x: np.array([0.5, 0.5]),
                                      samples=self.pop,
                                      num_iter=10,
                                      num_runs=5)
     self.assertEqual(test_p.shape, (5, 4, 2))
     npt.assert_array_equal(np.array([10, 20, 30, 40]), test_c)
示例#3
0
 def test_subsample_power_defaults(self):
     test_p, test_c = subsample_power(self.f,
                                      self.pop,
                                      num_iter=10,
                                      num_runs=5)
     self.assertEqual(test_p.shape, (5, 4))
     npt.assert_array_equal(np.array([10, 20, 30, 40]), test_c)
示例#4
0
 def test_subsample_power_matches(self):
     test_p, test_c = subsample_power(self.f,
                                      samples=self.pop,
                                      num_iter=10,
                                      num_runs=5,
                                      draw_mode="matched")
     self.assertEqual(test_p.shape, (5, 4))
     npt.assert_array_equal(np.array([10, 20, 30, 40]), test_c)
示例#5
0
 def test_subsample_power_counts(self):
     test_p, test_c = subsample_power(self.f,
                                      samples=self.pop,
                                      num_iter=10,
                                      num_runs=2,
                                      min_counts=5)
     self.assertEqual(test_p.shape, (2, 5))
     npt.assert_array_equal(np.arange(5, 50, 10), test_c)
示例#6
0
 def test_subsample_power_defaults(self):
     test_p, test_c = subsample_power(self.f, self.pop,
                                      num_iter=10, num_runs=5)
     self.assertEqual(test_p.shape, (5, 4))
     npt.assert_array_equal(np.array([10, 20, 30, 40]), test_c)
示例#7
0
 def test_subsample_power_min_observations_error(self):
     with self.assertRaises(ValueError):
         subsample_power(self.f,
                         samples=[np.ones((2)), np.ones((5))])
示例#8
0
 def test_subsample_power_matched_relationship_error(self):
     with self.assertRaises(ValueError):
         subsample_power(self.f,
                         samples=[np.ones((2)), np.ones((5))],
                         draw_mode="matched")