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:
- xtensor_like
The array to convolve.
- wtensor_like
The weight of the convolution. The last axis of
wdetermines the number of steps to use in the convolution.- axis
int The axis of
xalong witch to apply the convolution- mode
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.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:
- ytensor_like
The result of convolving
xwithwalong the desired axis. The shape of the result will match the shape ofxup to broadcasting withw. The convolved axis will show the results of left padding zeros toxwhile applying the convolutions.