batched_convolution#
- pymc_marketing.mmm.transformers.batched_convolution(x, w, axis=0, mode=ConvMode.After)[source]#
Apply a 1D convolution in a vectorized way across multiple batch dimensions.
(
Source code
,png
,hires.png
,pdf
)- Parameters:
x – The array to convolve.
w – The weight of the convolution. The last axis of
w
determines the number of steps to use in the convolution.axis (int) – The axis of
x
along witch to apply the convolutionmode (ConvMode, 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.Before.
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:
The result of convolving
x
withw
along the desired axis. The shape of the result will match the shape ofx
up to broadcasting withw
. The convolved axis will show the results of left padding zeros tox
while applying the convolutions.- Return type:
y