pymc.backends.zarr.ZarrChain#
- class pymc.backends.zarr.ZarrChain(store, stats_bijection, model=None, vars=None, test_point=None, draws_per_chunk=100, fn=None, warning_columns=None)[source]#
Interface object to interact with a single chain in a
ZarrTrace.- Parameters:
- store
zarr.abc.store.Store|collections.abc.MutableMapping The store object where the zarr groups and arrays will be stored and read from. This store must exist before creating a
ZarrChainobject.ZarrChainare only intended to be used as interfaces to the individual chains ofZarrTraceobjects. This means that theZarrTraceshould be the one that creates the store that is then provided to aZarrChain.- stats_bijection
pymc.step_methods.compound.StatsBijection An object that maps between a list of step method stats and a dictionary of said stats with the accompanying stepper index.
- model
BaseModel If None, the model is taken from the with context.
- vars
Sequence[TensorVariable] |None Sampling values will be stored for these variables. If None, model.unobserved_RVs is used.
- test_point
dict[str,numpy.ndarray] |None This is not used and is inherited from the signature of
BaseTrace, which uses it to determine the shape and dtype of vars.- draws_per_chunk
int The number of draws that make up a chunk in the variable’s posterior array. The interface only writes the samples to the store once a chunk is completely filled. The default of 100 amortizes the cost of zarr writes; setting it to
1gives the highest crash resilience, at the cost of a large slowdown.
- store
Methods
ZarrChain.__init__(store, stats_bijection[, ...])ZarrChain.buffer(group, var_name, value)Close the backend.
Write the data stored in the internal buffer to the desired zarr store.
ZarrChain.get_sampler_stats(stat_name[, ...])Get sampler statistics from the trace.
ZarrChain.get_values(varname[, burn, thin])Get values from trace.
ZarrChain.point(idx)Return point values at idx for current chain.
ZarrChain.record(draw, stats, *, in_warmup)Record the step method's returned draw and stats.
ZarrChain.setup(draws, chain, sampler_vars)Perform chain-specific setup.
Attributes
stat_nameschainChain number.
varnamesNames of tracked variables.
sampler_varsSampler stats for each sampler.