meridian.model.adstock_hill.compute_decay_weights
Stay organized with collections
Save and categorize content based on your preferences.
Computes decay weights using geometric and/or binomial decay.
meridian.model.adstock_hill.compute_decay_weights(
alpha: meridian.backend.Tensor,
l_range: meridian.backend.Tensor,
window_size: int,
decay_functions: (str | Sequence[str]) = constants.GEOMETRIC_DECAY,
normalize: bool = True
) -> meridian.backend.Tensor
This function always broadcasts the lag dimension (l_range) to the
trailing axis of the output tensor.
Args |
alpha
|
The parameter for the adstock decay function.
|
l_range
|
A 1D tensor representing the lag range, e.g., [w-1, w-2, ...,
0].
|
window_size
|
The number of time periods that go into the adstock weighted
average for each output time period.
|
decay_functions
|
String or sequence of strings indicating the decay
function(s) to use for the Adstock calculation. Allowed values
are 'geometric' and 'binomial'.
|
normalize
|
A boolean indicating whether to normalize the weights. Default:
True.
|
Returns |
A tensor of weights with a shape of (*alpha.shape, len(l_range)).
|
Raises |
ValueError
|
If the shape of decay_functions is not broadcastable to
the shape of alpha.
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-12-09 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-12-09 UTC."],[],[]]