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.
prelizattribute to get the equivalent distribution inprelizsample_priormethod to sample from the priorgraphget a dummy model graph with the distributionconstrainto 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_transformfunction or be available in eitherpytensor.tensororpymc.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
dimsThe dimensions of the variable.
distributionThe name of the PyMC distribution.
non_centered_distributionsprelizCreate an equivalent preliz distribution.
transformThe name of the transform to apply to the variable after it is created.
pymc_distributionpytensor_transform