Skip to content

Commit de6534d

Browse files
authored
Merge pull request #1355 from PyAutoLabs/feature/ep-hierarchical-regression
fix(graphical): seed inherently-stochastic test_full_hierachical (#1352)
2 parents ffc04d8 + 0a21509 commit de6534d

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

test_autofit/graphical/hierarchical/test_hierarchical.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,14 @@ def test_full_hierachical(data):
298298
},
299299
)
300300

301+
# This fits a *marginal* hierarchical EP model whose Laplace refinement draws
302+
# stochastic samples from the global np.random state (n_refine=3 via
303+
# NormalMessage.sample). The fit sits near a convergence boundary, so its
304+
# recovered fixed point (good vs sigma-collapse) depends on the ambient RNG
305+
# state left by whatever ran before — an inherently stochastic test. Seed here
306+
# so the fit is reproducible; this is the pragmatic fix (see PyAutoFit #1352).
307+
np.random.seed(0)
308+
301309
laplace = graph.LaplaceOptimiser()
302310
ep_opt = graph.EPOptimiser(model, default_optimiser=laplace)
303311
new_approx = ep_opt.run(model_approx, max_steps=10)

0 commit comments

Comments
 (0)