adstock#

Adstock transformations for MMM.

Each of these transformations is a subclass of pymc_marketing.mmm.components.adstock.AdstockTransformation and defines a function that takes a time series and returns the adstocked version of it. The parameters of the function are the parameters of the adstock transformation.

Examples#

Create a new adstock transformation:

from pymc_marketing.mmm import AdstockTransformation

class MyAdstock(AdstockTransformation):
    def function(self, x, alpha):
        return x * alpha

    default_priors = {"alpha": {"dist": "HalfNormal", "kwargs": {"sigma": 1}}}

Plot the default priors for an adstock transformation:

from pymc_marketing.mmm import GeometricAdstock

import matplotlib.pyplot as plt

adstock = GeometricAdstock(l_max=15)
prior = adstock.sample_prior()
curve = adstock.sample_curve(prior)
adstock.plot_curve(curve)
plt.show()

Classes

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

Subclass for all adstock functions.

DelayedAdstock(l_max[, normalize, mode, ...])

Wrapper around delayed adstock function.

GeometricAdstock(l_max[, normalize, mode, ...])

Wrapper around geometric adstock function.

WeibullAdstock(l_max[, normalize, kind, ...])

Wrapper around weibull adstock function.