Skip to content

Commit 5f99594

Browse files
Set up thinning
1 parent 0db6499 commit 5f99594

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

examples/rosenbrock.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ def run_example(
231231
hm.logs.info_log(
232232
"Realisation number = {}/{}".format(i_realisation + 1, n_realisations)
233233
)
234-
sample = True
234+
sample = False
235235
if sample:
236236
# =======================================================================
237237
# Run Emcee to recover posterior samples
@@ -307,6 +307,8 @@ def run_example(
307307
# Configure emcee chains for harmonic
308308
# =======================================================================
309309
estimate_evidence = True
310+
thin = True
311+
thin_by = 10**4
310312
if estimate_evidence:
311313
for i in range(chain_iterations):
312314

@@ -325,6 +327,8 @@ def run_example(
325327
"rb",
326328
) as f:
327329
samples = np.load(f)
330+
if thin:
331+
samples = samples[:, ::thin_by]
328332
with open(
329333
"examples/plots/logprob_rosenbrock_"
330334
+ str(ndim)
@@ -340,6 +344,8 @@ def run_example(
340344
"rb",
341345
) as f:
342346
lnprob = np.load(f)
347+
if thin:
348+
lnprob = lnprob[::thin_by]
343349

344350
chains = hm.Chains(ndim)
345351
chains.add_chains_3d(samples, lnprob)

0 commit comments

Comments
 (0)