prior#
Class that represents a prior distribution.
The Prior class is a wrapper around PyMC distributions that allows the user
to create outside of the PyMC model.
Note
This module has been deprecated and is moved to pymc_extras.prior.
This is the alternative to using the dictionaries in PyMC-Marketing models.
Examples#
Create a normal prior.
from pymc_extras.prior import Prior
normal = Prior("Normal")
Create a hierarchical normal prior by using distributions for the parameters and specifying the dims.
hierarchical_normal = Prior(
    "Normal",
    mu=Prior("Normal"),
    sigma=Prior("HalfNormal"),
    dims="channel",
)
Create a non-centered hierarchical normal prior with the centered parameter.
non_centered_hierarchical_normal = Prior(
    "Normal",
    mu=Prior("Normal"),
    sigma=Prior("HalfNormal"),
    dims="channel",
    # Only change needed to make it non-centered
    centered=False,
)
Create a hierarchical beta prior by using Beta distribution, distributions for the parameters, and specifying the dims.
hierarchical_beta = Prior(
    "Beta",
    alpha=Prior("HalfNormal"),
    beta=Prior("HalfNormal"),
    dims="channel",
)
Create a transformed hierarchical normal prior by using the transform
parameter. Here the “sigmoid” transformation comes from pm.math.
transformed_hierarchical_normal = Prior(
    "Normal",
    mu=Prior("Normal"),
    sigma=Prior("HalfNormal"),
    transform="sigmoid",
    dims="channel",
)
Create a prior with a custom transform function by registering it with
register_tensor_transform.
from pymc_extras.prior import register_tensor_transform
def custom_transform(x):
    return x**2
register_tensor_transform("square", custom_transform)
custom_distribution = Prior("Normal", transform="square")
Functions
Alternative deserializer that recursively handles all nested parameters.  | 
|
  | 
Check if the data is a dictionary representing a Prior (alternative check).  | 
  | 
Warn about the deprecation of this module.  | 
Warn about the deprecation of this function.  | 
Classes