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 every dot_every MCMC iterations, None to disable.

  • report_every (int | Integer[Array, ''] | None, default: 100) – A one line report is printed every report_every MCMC iterations, None to disable.

  • average (bool, default: True) – If True, the reported statistics are averaged over the iterations since the previous report; if False, they reflect the current iteration only. Ignored when report_every is None.

Returns:

dict[str, Any] – A dictionary with the arguments to pass to run_mcmc as keyword arguments to set up the callback.

Examples

>>> run_mcmc(key, state, ..., **make_print_callback(state, ...))