AdstockTransformation#

class pymc_marketing.mmm.components.adstock.AdstockTransformation(l_max, normalize=True, mode=ConvMode.After, priors=None, prefix=None)[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

  • default_priors: dictionary with priors for every parameter in function

Consider the predefined subclasses as examples.

Methods

AdstockTransformation.__init__(l_max[, ...])

AdstockTransformation.apply(x[, dims])

Called within a model context.

AdstockTransformation.plot_curve(curve[, ...])

Plot curve HDI and samples.

AdstockTransformation.plot_curve_hdi(curve)

Plot the HDI of the curve.

AdstockTransformation.plot_curve_samples(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.

AdstockTransformation.update_priors(priors)

Helper to update the priors for a function after initialization.

Attributes

model_config

Mapping from variable name to prior for the model.

prefix

variable_mapping

Mapping from parameter name to variable name in the model.

lookup_name

default_priors

function