You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The pymc-marketing.prior module introduces protocol class, VariableFactory:
dims the dimensions of variable
create_variable method to create a pytensor variable
Prior Class
The Prior class implements this and is interface to work with PyMC distributions. i.e. Prior("Normal", mu=0, sigma=1, dims="covariate") will eval to pm.Normal(name, mu=0, sigma=1, dims="covariate") upon call prior.create_variable(name)
There are some additional features like, automatic dimension handling for nested distributions
# Straight forwardPrior("Normal", mu=Prior("Normal"), sigma=1, dims="covariate")
# The transpose is handled automatically making changes to the dimensions easierPrior("Normal", mu=Prior("Normal", dims="covariate"), sigma=1, dims=("covariate", "geo"))
There have been some efforts to change the syntax to be closer to pm or pz but has caused some documentation issues.
Automatic Centering flag
Prior class takes centered flag at initialization which will determine how to create the variable upon create_variable call. It only works for a few distributions like Normal, StudentT, ZeroSumNormal
Uh oh!
There was an error while loading. Please reload this page.
Port this self-containing* module to pymc-extras
The
pymc-marketing.prior
module introduces protocol class,VariableFactory
:dims
the dimensions of variablecreate_variable
method to create a pytensor variablePrior Class
The
Prior
class implements this and is interface to work with PyMC distributions. i.e. Prior("Normal", mu=0, sigma=1, dims="covariate") will eval to pm.Normal(name, mu=0, sigma=1, dims="covariate") upon callprior.create_variable(name)
There are some additional features like, automatic dimension handling for nested distributions
There have been some efforts to change the syntax to be closer to
pm
orpz
but has caused some documentation issues.Automatic Centering flag
Prior class takes
centered
flag at initialization which will determine how to create the variable uponcreate_variable
call. It only works for a few distributions like Normal, StudentT, ZeroSumNormalhttps://github.com/pymc-labs/pymc-marketing/blob/a87f1fa979d5694ee4d50d1fd2f3519c7c4e50f5/pymc_marketing/prior.py?plain=1#L410-L414
Note
The
VariableFactory
protocol can always be followed to create a custom distribution.transform
parameterpm.math, pytensor.tensor, or registered transformations can be used in the
transform
parameter. ThisSerialization
This comes with easy serialization to JSON for deployment use-cases
Closer syntax to pm
See pymc-labs/pymc-marketing#1540
Other Features
There is also
Censored
class wrapper aroundpm.Censored
which implements the protocol.Issues from https://github.com/pymc-labs/pymc-marketing/issues?q=is%3Aissue%20state%3Aopen%20label%3A%22Prior%20class%22
Additional Information
Warning
Caveats include depending on pydantic
The text was updated successfully, but these errors were encountered: