How to create a Bayesian model with Number of Markov chain iterations value, Number of Burn-in iterations and Number of thining iterations as arguments. And then how to get geweke results from the model?
Thanks for your response.
pymc3.sampling.sample(draws=1000, step=None, init='auto', n_init=200000, start=None, trace=None, chain_idx=0, chains=None, cores=None, tune=1000, progressbar=True, model=None, random_seed=None, discard_tuned_samples=True, compute_convergence_checks=True, callback=None, *, return_inferencedata=None, idata_kwargs: dict = None, mp_ctx=None, pickle_backend: str = 'pickle', **kwargs)
here i cant find brun-in iteration and number of thining itereation. Could you please help with that?
tune is the burn-in, thinning you need to do that manually (i.e., slicing the array).
Thank you for your response. I still didn’t get how to find thinning. I am totally new to this. can you please help me with some more explanation.
It goes something like:
with pm.Model(): # you model code trace = pm.sample(num_samples, tune=num_burn_in, cores=num_chain, return_inferencedata=True) trace_thinned = trace.posterior.sel(draw=slice(0, num_samples, num_thinning))
Re thinning, this is not a recommended practice any more since it doesnt improves NUTS/HMC samples
It crashed my system. When i put tune=500 and cores=100000
cores are number of cores/thread you want to run your chains in parallel, it should be equal or smaller than the number of cores you have on your CPU.
Maybe this is less confusing
with pm.Model(): # you model code trace = pm.sample(num_samples, tune=num_burn_in, chains=num_chain, return_inferencedata=True) trace_thinned = trace.posterior.sel(draw=slice(0, num_samples, num_thinning))
This is from @OriolAbril:
you can even do
trace_thinned = trace.sel(draw=slice(0, None, num_thinning))
to thin all groups (posterior, posterior_predictive, sample_stats , prior…) at the same time and without knowing the total number of draws