Exemplo n.º 1
0
# %%

title = f"MH Bivariate Normal "  + r"$q_1$" + f": γ={γ}, nsample={nsample}, accepted={int(100.0*float(accepted)/float(nsample))}%"
gplot.pdf_samples(title, bv.marginal(0.0, σ1), q[:,0], "hamiltonian_monte_carlo",  f"{file_prefix}-samples-1")

# %%

title = f"MH Bivariate Normal "  + r"$q_2$" + f": γ={γ}, nsample={nsample}, accepted={int(100.0*float(accepted)/float(nsample))}%"
gplot.pdf_samples(title, bv.marginal(0.0, σ2), q[:,1], "hamiltonian_monte_carlo",  f"{file_prefix}-samples-2")

# %%

title = f"MH Bivariate Normal "  + r"$q_1$" + f": γ={γ}, nsample={nsample}, accepted={int(100.0*float(accepted)/float(nsample))}%"
vals = q[:,0]
time = range(9000, 9500)
hmc.time_series(title, vals[time], time, [min(vals), max(vals)], f"{file_prefix}-timeseries-1")

# %%

title = f"MH Bivariate Normal " + r"$q_2$" + f": γ={γ}, nsample={nsample}, accepted={int(100.0*float(accepted)/float(nsample))}%"
vals = q[:,1]
time = range(9000, 9500)
hmc.time_series(title, vals[time], time, [min(vals), max(vals)], f"{file_prefix}-timeseries-2")

# %%

title = f"MH Bivariate Normal " + r"$q_1$" + f": γ={γ}, nsample={nsample}, accepted={int(100.0*float(accepted)/float(nsample))}%"
time = range(0, len(q[:,0]))
hmc.cumulative_mean(title, q[:,0], time, 0.0, [-1.0, 2.0], f"{file_prefix}-cummulative-mean-1")

# %%
Exemplo n.º 2
0
hmc.pdf_samples_contour(pdf, p, q, xrange, yrange, [0.01, 0.025, 0.05, 0.1, 0.15, 0.2], ["q", "p"], title, "hmc-normal-phase-space-histogram-1")

# %%

hmc.distribution_samples(p, q, xrange, yrange,  ["q", "p"], title, "hmc-normal-phase-space-histogram-2")

# %%

title = f"HMC Normal Target: Δt={ε}, nsteps={nsteps}, nsample={nsample}, accepted={accept}"
gplot.pdf_samples(title, target_pdf(σ), q, "hamiltonian_monte_carlo", "hmc-normal-sampled-pdf-1")

# %%

title = f"HMC Normal Target: Δt={ε}, nsteps={nsteps}, nsample={nsample}, accepted={accept}"
time = range(0, len(q))
hmc.time_series(title, q, time, [min(q), max(q)], "hmc-normal-position-timeseries-1")

# %%

title = f"HMC Normal Target: Δt={ε}, nsteps={nsteps}, nsample={nsample}, accepted={accept}"
time = range(9000, 9500)
hmc.time_series(title, q[time], time, [min(q), max(q)], "hmc-normal-position-timeseries-2")

# %%

title = f"HMC Normal Target: Δt={ε}, nsteps={nsteps}, nsample={nsample}, accepted={accept}"
time = range(0, len(q))
hmc.cumulative_mean(title, q, time, 0.0, [-0.5, 0.5], "hmc-normal-position-cummulative-mean-1")

# %%