Prior specification#

A declarative way to define (hierarchical) prior distributions that can be serialized to and from JSON. Useful when priors are part of a configuration file rather than hardcoded in a model, as in pymc-marketing.

Prior(distribution, *[, dims, centered, ...])

A class to represent a prior distribution.

Censored(distribution[, lower, upper])

Create censored random variable.

Scaled(dist, factor)

Scaled distribution for numerical stability.

sample_prior(factory[, coords, name, wrap, ...])

Sample the prior for an arbitrary VariableFactory.

create_dim_handler(desired_dims)

Wrap the handle_dims() function to always use the same desired_dims.

handle_dims(x, dims, desired_dims)

Take a tensor of dims dims and align it to desired_dims.

register_tensor_transform(name, transform)

Register a tensor transform function to be used in the Prior class.

VariableFactory(*args, **kwargs)

Protocol for something that works like a Prior class.

From a previous model#

Build a prior from the posterior of a previously fitted model, enabling simple Bayesian updating workflows.

prior.prior_from_idata(idata[, name, var_names])

Create a prior from posterior using MvNormal approximation.

Deserialization#

Registry that maps JSON data back to Python objects, used to round-trip Prior definitions and extensible to arbitrary custom types.

deserialize(data)

Deserialize a dictionary into a Python object.

register_deserialization(is_type, deserialize)

Register an arbitrary deserialization.

Deserializer(is_type, deserialize)

Object to store information required for deserialization.