Transformation#
- class pymc_marketing.mmm.components.base.Transformation(priors=None, prefix=None)[source]#
Base class for adstock and saturation functions.
The subclasses will need to implement the following attributes:
function: The function that will be applied to the data.
prefix: The prefix for the variables that will be created.
default_priors: The default priors for the parameters of the function.
In order to make a new saturation or adstock function, use the specific subclasses:
View the documentation for those classes for more information.
- Parameters:
- priors
dict
[str
,Prior
|float
|TensorVariable
|VariableFactory
], optional Dictionary with the priors for the parameters of the function. The keys should be the parameter names and the values the priors. If not provided, it will use the default priors from the subclass.
- prefix
str
, optional The prefix for the variables that will be created. If not provided, it will use the prefix from the subclass.
- priors
Methods
Transformation.__init__
([priors, prefix])Transformation.apply
(x[, dims])Call within a model context.
Transformation.plot_curve
(curve[, ...])Plot curve HDI and samples.
Transformation.plot_curve_hdi
(curve[, ...])Plot the HDI of the curve.
Transformation.plot_curve_samples
(curve[, ...])Plot samples from the curve.
Transformation.sample_prior
([coords])Sample the priors for the transformation.
Set the dims for all priors.
Convert the transformation to a dictionary.
Transformation.update_priors
(priors)Update the priors for a function after initialization.
Attributes
combined_dims
Get the combined dims for all the parameters.
function_priors
Get the priors for the function.
model_config
Mapping from variable name to prior for the model.
variable_mapping
Mapping from parameter name to variable name in the model.
prefix
default_priors
function
lookup_name