I found it's helpful to have a sample call that does: run untill meeting with a fixed number of step followed.
Something like below.
using CoupledHMC: get_ahmc_primitives, sample
function sample_after_meeting(target, alg::CoupledHMCSampler, n_after_samples::Int; theta0=nothing, progress=false)
rng, hamiltonian, proposal, theta0 = get_ahmc_primitives(target, alg, theta0)
samples = sample_until_meeting(rng, hamiltonian, proposal, theta0)
samples_after_meeting = sample(
target, HMCSampler(rinit=alg.rinit, TS=alg.TS, ϵ=alg.ϵ, L=alg.L), n_after_samples;
theta0=samples[end][:,1], progress=progress
)
# Duplicate the `n_samples_left` part to make the dimension consistent
samples_after_meeting = map(s -> cat(s, s; dims=2), samples_after_meeting)
return cat(samples, samples_after_meeting; dims=1)
end
This way of simulation kind of ensures unbiaseness with some level of confidence on variance (as we ask to always run for centain steps after the meeting).
I found it's helpful to have a sample call that does: run untill meeting with a fixed number of step followed.
Something like below.
This way of simulation kind of ensures unbiaseness with some level of confidence on variance (as we ask to always run for centain steps after the meeting).