pymc.backends.zarr.ZarrTrace.init_trace#

ZarrTrace.init_trace(chains, draws, tune, step, model=None, vars=None, test_point=None)[source]#

Initialize the trace groups and arrays.

This function creates and fills with default values the groups below the ZarrTrace.root group. It creates the constant_data, observed_data, posterior, unconstrained_posterior (if include_transformed = True), sample_stats, and _sampling_state zarr groups, and all of the relevant arrays that must be stored there.

Every array in the posterior and sample stats groups will have the (chains, tune + draws) batch dimensions to the left of the core dimensions of the model’s random variable or the step method’s stat shape. The warmup (tuning draws) and the posterior samples are split at a later stage, once split_warmup_groups() is called.

After the creation if the zarr hierarchies, it initializes the list of Zarrchain instances (one for each chain) under the straces attribute. These objects serve as the interface to record draws and samples generated by the step methods for each chain.

Parameters:
chainsint

The number of chains to use to initialize the arrays.

drawsint

The number of posterior draws to use to initialize the arrays.

tuneint

The number of tuning steps to use to initialize the arrays.

steppymc.step_methods.compound.BlockedStep | pymc.step_methods.compound.CompoundStep

The step method that will be used to generate the draws and stats.

modelpymc.model.core.Model | None

If None, the model is taken from the with context.

varsSequence[TensorVariable] | None

Sampling values will be stored for these variables. If None, model.unobserved_RVs is used.

test_pointdict[str, numpy.ndarray] | None

This is not used and is a product of the inheritance of ZarrChain from BaseTrace, which uses it to determine the shape and dtype of vars.