From 1d611c122c28f19b2010b15c0a1eebf1d07f714f Mon Sep 17 00:00:00 2001 From: statrita2004 Date: Sat, 14 Dec 2019 16:26:15 +0000 Subject: [PATCH] Fixing error in APMCABC --- abcpy/inferences.py | 2 +- tests/inferences_tests.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/abcpy/inferences.py b/abcpy/inferences.py index d3fc611a..2cefa7cd 100644 --- a/abcpy/inferences.py +++ b/abcpy/inferences.py @@ -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 diff --git a/tests/inferences_tests.py b/tests/inferences_tests.py index 56db701c..7542fdba 100644 --- a/tests/inferences_tests.py +++ b/tests/inferences_tests.py @@ -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)