meridian.model.adstock_hill.AdstockTransformer

Class to compute the Adstock transformation of media.

Inherits From: AdstockHillTransformer

alpha
Tensor of alpha parameters taking values in [0, 1] with dimensions [..., n_media_channels] . Batch dimensions (...) are optional. Note that alpha = 0 is allowed, so it is possible to put a point mass prior at zero (effectively no Adstock).
max_lag
Integer indicating the maximum number of lag periods (≥ 0 ) to include in the Adstock calculation.
n_times_output
Integer indicating the number of time periods to include in the output tensor. Cannot exceed the number of time periods of the media argument, for example, media.shape[-2] . The output time periods correspond to the most recent time periods of the media argument. For example, media[..., -n_times_output:, :] represents the media execution of the output weeks.
decay_functions
String or list of strings indicating the decay function(s) to use for the Adstock calculation for each channel. Default is geometric decay for all channels.

Methods

forward

View source

Computes the Adstock transformation of a given media tensor.

For geo g , time period t , and media channel m , Adstock is calculated as adstock_{g,t,m} = sum_{i=0}^max_lag media_{g,t-i,m} alpha^i .

Args

media
Tensor of media values with dimensions [..., n_geos, n_media_times, n_media_channels] . Batch dimensions (...) are optional, but if batch dimensions are included, they must match the batch dimensions of alpha . Media is not required to have batch dimensions even if alpha contains batch dimensions.

Returns
Tensor with dimensions [..., n_geos, n_times_output, n_media_channels] representing Adstock transformed media.

Create a Mobile Website
View Site in Mobile | Classic
Share by: