Prior.create_variable#

Prior.create_variable(name)[source]#

Create a PyMC variable from the prior.

Must be used in a PyMC model context.

Parameters:
namestr

The name of the variable.

Returns:
pt.TensorVariable

The PyMC variable.

Examples

Create a hierarchical normal variable in larger PyMC model.

dist = Prior(
    "Normal",
    mu=Prior("Normal"),
    sigma=Prior("HalfNormal"),
    dims="channel",
)

coords = {"channel": ["C1", "C2", "C3"]}
with pm.Model(coords=coords):
    var = dist.create_variable("var")