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)
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)
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)
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)
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)
def test_subsample_power_min_observations_error(self): with self.assertRaises(ValueError): subsample_power(self.f, samples=[np.ones((2)), np.ones((5))])
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")