AdstockTransformation#
- class pymc_marketing.mmm.components.adstock.AdstockTransformation(l_max=FieldInfo(annotation=NoneType, required=True, description='Maximum lag for the adstock transformation.', metadata=[Gt(gt=0)]), normalize=FieldInfo(annotation=NoneType, required=False, default=True, description='Whether to normalize the adstock values.'), mode=FieldInfo(annotation=NoneType, required=False, default=<ConvMode.After: 'After'>, description='Convolution mode.'), priors=FieldInfo(annotation=NoneType, required=False, default=None, description='Priors for the parameters.'), prefix=FieldInfo(annotation=NoneType, required=False, default=None, description='Prefix for the parameters.'))[source]#
Subclass for all adstock functions.
In order to use a custom saturation function, inherit from this class and define:
function: a function that takes x to adstock x, along a givendimdefault_priors: dictionary with priors for every parameter in function
Consider the predefined subclasses as examples.
Methods
AdstockTransformation.__init__([l_max, ...])AdstockTransformation.apply(x, *[, ...])Call within a model context.
Reconstruct a transformation from a dict.
AdstockTransformation.plot_curve(curve[, ...])Plot curve HDI and samples.
Plot the HDI of the curve.
Plot samples from the curve.
AdstockTransformation.sample_curve(parameters)Sample the adstock transformation given parameters.
AdstockTransformation.sample_prior([coords])Sample the priors for the transformation.
Set the dims for all priors.
Convert the adstock transformation to a dictionary.
Update the priors for a function after initialization.
Return a copy with default prior dims (dims=None) set to
dimsinstead.Return a copy with updated priors.
Attributes
Get the combined dims for all the parameters.
Get the priors for the function.
Mapping from variable name to prior for the model.
Get the priors for the function.
Mapping from parameter name to variable name in the model.