pymc.backends.zarr.ZarrChain#
- class pymc.backends.zarr.ZarrChain(store, stats_bijection, synchronizer=None, model=None, vars=None, test_point=None, draws_per_chunk=1, fn=None)[source]#
Interface object to interact with a single chain in a
ZarrTrace.- Parameters:
- store
zarr.storage.BaseStore|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.
- synchronizer
zarr.sync.Synchronizer|None The synchronizer to use for the underlying zarr arrays.
- model
Model 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.
- 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.link_stepper(step_method)Provide a reference to the step method used during sampling.
ZarrChain.point(idx)Return point values at idx for current chain.
ZarrChain.record(draw, stats)Record the step method's returned draw and stats.
ZarrChain.record_sampling_state([step])Record the sampling state information to the store's
_sampling_stategroup.ZarrChain.setup(draws, chain, sampler_vars)Perform chain-specific setup.
ZarrChain.store_sampling_state(sampling_state)Attributes
stat_nameschainChain number.
varnamesNames of tracked variables.
sampler_varsSampler stats for each sampler.