Prior#
- class pymc_marketing.prior.Prior(distribution, *, dims=None, centered=True, transform=None, **parameters)[source]#
A class to represent a prior distribution.
This is the alternative to using the dictionaries in PyMC-Marketing models but provides added flexibility and functionality.
Make use of the various helper methods to understand the distributions better.
preliz
attribute to get the equivalent distribution inpreliz
sample_prior
method to sample from the priorgraph
get a dummy model graph with the distributionconstrain
to shift the distribution to a different range
- Parameters:
- distribution
str
The name of PyMC distribution.
- dims
Dims
, optional The dimensions of the variable, by default None
- centeredbool, optional
Whether the variable is centered or not, by default True. Only allowed for Normal distribution.
- transform
str
, optional The name of the transform to apply to the variable after it is created, by default None or no transform. The transformation must be registered with
register_tensor_transform
function or be available in eitherpytensor.tensor
orpymc.math
.
- distribution
Methods
Prior.__init__
(distribution, *[, dims, ...])Prior.constrain
(lower, upper[, mass, kwargs])Create a new prior with a given mass constrained within the given bounds.
Prior.create_likelihood_variable
(name, mu, ...)Create a likelihood variable from the prior.
Prior.create_variable
(name)Create a PyMC variable from the prior.
Return a deep copy of the prior.
Prior.from_dict
(data)Create a Prior from the dictionary format.
Prior.sample_prior
([coords, name])Sample the prior distribution for the variable.
Convert the prior to dictionary format.
Generate a graph of the variables.
Attributes
dims
The dimensions of the variable.
distribution
The name of the PyMC distribution.
non_centered_distributions
preliz
Create an equivalent preliz distribution.
transform
The name of the transform to apply to the variable after it is created.
pymc_distribution
pytensor_transform