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.rootgroup. It creates theconstant_data,observed_data,posterior,unconstrained_posterior(ifinclude_transformed = True),sample_stats, and_sampling_statezarr 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
Zarrchaininstances (one for each chain) under thestracesattribute. These objects serve as the interface to record draws and samples generated by the step methods for each chain.- Parameters:
- chains
int The number of chains to use to initialize the arrays.
- draws
int The number of posterior draws to use to initialize the arrays.
- tune
int The number of tuning steps to use to initialize the arrays.
- step
pymc.step_methods.compound.BlockedStep|pymc.step_methods.compound.CompoundStep The step method that will be used to generate the draws and stats.
- model
pymc.model.core.Model|None If None, the model is taken from the
withcontext.- vars
Sequence[TensorVariable] |None Sampling values will be stored for these variables. If
None,model.unobserved_RVsis used.- test_point
dict[str,numpy.ndarray] |None This is not used and is a product of the inheritance of
ZarrChainfromBaseTrace, which uses it to determine the shape and dtype of vars.
- chains