Skip to content

Commit

Permalink
Fixing error in APMCABC
Browse files Browse the repository at this point in the history
  • Loading branch information
statrita2004 committed Dec 14, 2019
1 parent e8a78c9 commit 1d611c1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion abcpy/inferences.py
Original file line number Diff line number Diff line change
Expand Up @@ -2468,7 +2468,7 @@ def _accept_parameter(self, rng, npc=None):
denominator = 0.0
for i in range(len(self.accepted_parameters_manager.accepted_weights_bds.value())):
pdf_value = self.kernel.pdf(mapping_for_kernels, self.accepted_parameters_manager,
self.accepted_parameters_manager.accepted_parameters_bds.value()[index[0]], perturbation_output[1])
self.accepted_parameters_manager.accepted_parameters_bds.value()[i], perturbation_output[1])
denominator += self.accepted_parameters_manager.accepted_weights_bds.value()[i, 0] * pdf_value
weight = 1.0 * prior_prob / denominator

Expand Down
4 changes: 2 additions & 2 deletions tests/inferences_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -453,8 +453,8 @@ def test_sample(self):
self.assertEqual(mu_sample_shape, (10,1))
self.assertEqual(sigma_sample_shape, (10,1))
self.assertEqual(weights_sample_shape, (10,1))
self.assertLess(mu_post_mean - (-2.785), 10e-2)
self.assertLess(sigma_post_mean - 6.2058, 10e-2)
self.assertLess(mu_post_mean - (-3.397848324005792), 10e-2)
self.assertLess(sigma_post_mean - 6.451434816944525, 10e-2)

self.assertFalse(journal.number_of_simulations == 0)

Expand Down

0 comments on commit 1d611c1

Please sign in to comment.