Skip to content

Commit 16b72d5

Browse files
Change example back to 2D.
1 parent 92658ff commit 16b72d5

File tree

1 file changed

+19
-9
lines changed

1 file changed

+19
-9
lines changed

examples/rosenbrock.py

+19-9
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ def run_example(
205205
"""
206206
Set up and run multiple simulations
207207
"""
208-
n_realisations = 2
208+
n_realisations = 1
209209
ln_evidence_inv_summary = np.zeros((n_realisations, 5))
210210
for i_realisation in range(n_realisations):
211211
if n_realisations > 1:
@@ -300,15 +300,22 @@ def run_example(
300300
# ======================================================================
301301
# Display evidence computation results.
302302
# ======================================================================
303-
hm.logs.debug_log(
303+
hm.logs.info_log(
304304
"Evidence: numerical = {}, estimate = {}".format(
305305
evidence_numerical_integration, np.exp(ln_evidence)
306306
)
307307
)
308308

309+
hm.logs.info_log(
310+
"Ln evidence numerical = {}".format(
311+
np.log(evidence_numerical_integration)
312+
)
313+
)
314+
309315
hm.logs.debug_log(
310316
"Inv Evidence: numerical = {}, estimate = {}".format(
311-
1.0 / evidence_numerical_integration, ev.evidence_inv
317+
1.0 / evidence_numerical_integration,
318+
np.exp(ev.ln_evidence_inv),
312319
)
313320
)
314321
diff = np.log(np.abs(evidence_numerical_integration - np.exp(ln_evidence)))
@@ -320,8 +327,11 @@ def run_example(
320327

321328
hm.logs.info_log(
322329
"Inv Evidence: |numerical - estimate| / estimate = {}".format(
323-
np.abs(1.0 / evidence_numerical_integration - ev.evidence_inv)
324-
/ ev.evidence_inv
330+
np.abs(
331+
1.0 / evidence_numerical_integration
332+
- np.exp(ev.ln_evidence_inv)
333+
)
334+
/ np.exp(ev.ln_evidence_inv)
325335
)
326336
)
327337

@@ -472,10 +482,10 @@ def run_example(
472482
lg.setup_logging()
473483

474484
# Define parameters.
475-
ndim = 10
476-
nchains = 1000
477-
samples_per_chain = 10e6
478-
nburn = 10000
485+
ndim = 2
486+
nchains = 100
487+
samples_per_chain = 5000
488+
nburn = 1000
479489

480490
# flow_str = "RealNVP"
481491
flow_str = "RQSpline"

0 commit comments

Comments
 (0)