Skip to content

Commit

Permalink
Set up thinning
Browse files Browse the repository at this point in the history
  • Loading branch information
alicjapolanska committed Nov 25, 2024
1 parent 0db6499 commit 5f99594
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion examples/rosenbrock.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ def run_example(
hm.logs.info_log(
"Realisation number = {}/{}".format(i_realisation + 1, n_realisations)
)
sample = True
sample = False
if sample:
# =======================================================================
# Run Emcee to recover posterior samples
Expand Down Expand Up @@ -307,6 +307,8 @@ def run_example(
# Configure emcee chains for harmonic
# =======================================================================
estimate_evidence = True
thin = True
thin_by = 10**4
if estimate_evidence:
for i in range(chain_iterations):

Expand All @@ -325,6 +327,8 @@ def run_example(
"rb",
) as f:
samples = np.load(f)
if thin:
samples = samples[:, ::thin_by]
with open(
"examples/plots/logprob_rosenbrock_"
+ str(ndim)
Expand All @@ -340,6 +344,8 @@ def run_example(
"rb",
) as f:
lnprob = np.load(f)
if thin:
lnprob = lnprob[::thin_by]

chains = hm.Chains(ndim)
chains.add_chains_3d(samples, lnprob)
Expand Down

0 comments on commit 5f99594

Please sign in to comment.