Dot#
- class pymc_marketing.terms.Dot(*, var_name, prior, name=None)[source]#
Linear predictor term:
data @ beta.Registers the data variable as
pmd.Datafor out-of-sample prediction.- Parameters:
- var_name
str Name of the data variable in the dataset.
- prior
VariableFactory Prior for the beta coefficients. Any
VariableFactoryis accepted. Must have dims matching the last dimension of the data variable.- name
str, optional Name for the coefficient variable. Defaults to
{var_name}_beta. Provide a distinctnameto reference the samevar_namefrom multiple terms (e.g. separate alpha and beta coefficient branches) without colliding on the coefficient variable name.
- var_name
Examples
from pymc_extras.prior import Prior from pymc_marketing.terms import ( Dot, Intercept, collect_coords, register_data, build_param, ) # basic mu = Intercept("mu") + Dot(var_name="x", prior=Prior("Normal", dims="feature")) # two branches on the same data, distinct coefficient names alpha_branch = Dot( var_name="x", name="alpha_coef", prior=Prior("Normal", dims="feature") ) beta_branch = Dot( var_name="x", name="beta_coef", prior=Prior("Normal", dims="feature") )
Methods
Dot.__init__(*, var_name, prior[, name])Dot.add_coords(ds)Add coordinates to the model during
register_data.Build
data @ betatensor.Dot.from_dict(data)Reconstruct a dot term from its serialized form.
Dot.get_coords(ds)Extract coordinates from the data variable.
Register the data variable as
pmd.Data.Dot.set_data(ds[, model])Update
pmd.Datafor prediction.Dot.to_dict([_orig])Attributes