binomial_adstock#

pymc_marketing.mmm.transformers.binomial_adstock(x, alpha=0.5, l_max=12, normalize=False, axis=0, mode=ConvMode.After)[source]#

Binomial adstock transformation.

Binomial adstock assumes that the effect of one unit of spend at time \(0 \le t \le l_{max} + 1\) is given by

\[f(t) = \left(1 - \frac{t}{L+ 1} \right)^{\left(\frac{1}{\alpha} - 1\right)}.\]

Notice that \(f(l_{max} + 1)=0\).

(Source code, png, hires.png, pdf)

../../_images/pymc_marketing-mmm-transformers-binomial_adstock-1.png
Parameters:
xtensor

Input tensor.

alphafloat, by default 0.5

Retention rate of ad effect. Must be between 0 and 1.

l_maxint, by default 12

Maximum duration of carryover effect.

normalizebool, by default False

Whether to normalize the weights.

axisint

The axis of x along witch to apply the convolution

modeConvMode, optional

The convolution mode determines how the convolution is applied at the boundaries of the input signal, denoted as “x.” The default mode is ConvMode.After.

  • ConvMode.After: Applies the convolution with the “Adstock” effect, resulting in a trailing decay effect.

  • ConvMode.Before: Applies the convolution with the “Excitement” effect, creating a leading effect

    similar to the wow factor.

  • ConvMode.Overlap: Applies the convolution with both “Pull-Forward” and “Pull-Backward” effects,

    where the effect overlaps with both preceding and succeeding elements.

Returns:
tensor

Transformed tensor.