bartz.mcmcloop.make_print_callback¶
- bartz.mcmcloop.make_print_callback(state, *, dot_every=1, report_every=100, average=True)[source]¶
Prepare a progress-printing callback for
run_mcmc.The callback prints a dot on every iteration, and a longer report periodically.
- Parameters:
state (
State) – The MCMC state to use the callback with, used to determine device sharding.dot_every (
int|Integer[Array, '']|None, default:1) – A dot is printed everydot_everyMCMC iterations,Noneto disable.report_every (
int|Integer[Array, '']|None, default:100) – A one line report is printed everyreport_everyMCMC iterations,Noneto disable.average (
bool, default:True) – IfTrue, the reported statistics are averaged over the iterations since the previous report; ifFalse, they reflect the current iteration only. Ignored whenreport_everyisNone.
- Returns:
dict[str,Any] – A dictionary with the arguments to pass torun_mcmcas keyword arguments to set up the callback.
Examples
>>> run_mcmc(key, state, ..., **make_print_callback(state, ...))