From d4844fc77e192a67f106a858b7ef0eaafe88c3a8 Mon Sep 17 00:00:00 2001 From: Brady Planden Date: Wed, 20 Nov 2024 11:24:33 +0000 Subject: [PATCH] tests: update sampling configuration --- tests/integration/test_monte_carlo_thevenin.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tests/integration/test_monte_carlo_thevenin.py b/tests/integration/test_monte_carlo_thevenin.py index f9d024ed8..e0c5f2d2b 100644 --- a/tests/integration/test_monte_carlo_thevenin.py +++ b/tests/integration/test_monte_carlo_thevenin.py @@ -100,6 +100,7 @@ def map_estimate(self, posterior): "max_unchanged_iterations": 35, "absolute_tolerance": 1e-7, "sigma0": [3e-4, 3e-4], + "verbose": True, } optim = pybop.CMAES(posterior, **common_args) results = optim.run() @@ -127,17 +128,18 @@ def test_sampling_thevenin(self, sampler, posterior, map_estimate): x0 = np.clip(map_estimate + np.random.normal(0, 1e-3, size=2), 1e-4, 1e-1) common_args = { "log_pdf": posterior, - "chains": 3, - "warm_up": 550, + "chains": 2, + "warm_up": 100, "cov0": [2e-3, 2e-3], - "max_iterations": 2000, + "max_iterations": 1050, "x0": x0, } # construct and run sampler = sampler(**common_args) if isinstance(sampler, SliceRankShrinkingMCMC): - sampler._samplers[0].set_hyper_parameters([1e-3]) + for i, _j in enumerate(sampler._samplers): + sampler._samplers[i].set_hyper_parameters([1e-3]) chains = sampler.run() # Test PosteriorSummary @@ -146,7 +148,7 @@ def test_sampling_thevenin(self, sampler, posterior, map_estimate): np.testing.assert_array_less(0, ess) if not isinstance(sampler, RelativisticMCMC): np.testing.assert_array_less( - summary.rhat(), 1.2 + summary.rhat(), 1.5 ) # Large rhat, to enable faster tests # Assert both final sample and posterior mean