meridian.model.media.MediaTensors
Stay organized with collections
Save and categorize content based on your preferences.
Container for (paid) media tensors.
meridian.model.media.MediaTensors(
media: (meridian.backend.Tensor | None) = None,
media_spend: (meridian.backend.Tensor | None) = None,
media_transformer: (meridian.model.transformers.MediaTransformer | None) = None,
media_scaled: (meridian.backend.Tensor | None) = None,
prior_media_scaled_counterfactual: (meridian.backend.Tensor | None) = None,
prior_denominator: (meridian.backend.Tensor | None) = None
)
Attributes |
media
|
A tensor constructed from InputData.media.
|
media_spend
|
A tensor constructed from InputData.media_spend.
|
media_transformer
|
A MediaTransformer to scale media tensors using the
model's media data.
|
media_scaled
|
The media tensor after pre-modeling transformations including
population scaling and scaling by the median non-zero value.
|
prior_media_scaled_counterfactual
|
A tensor containing media_scaled values
corresponding to the counterfactual scenario required for the prior
calculation. For ROI priors, the counterfactual scenario is where media is
set to zero during the calibration period. For mROI priors, the
counterfactual scenario is where media is increased by a small factor for
all n_media_times. For contribution priors, the counterfactual scenario
is where media is set to zero for all n_media_times. This attribute is
set to None when it would otherwise be a tensor of zeros, i.e., when
contribution contribution priors are used, or when ROI priors are used and
roi_calibration_period is None.
|
prior_denominator
|
If ROI, mROI, or contribution priors are used, this
represents the denominator. It is a tensor with dimension equal to
n_media_channels. For ROI priors, it is the spend during the overlapping
time periods between the calibration period and the modeling time window.
For mROI priors, it is the ROI prior denominator multiplied by a small
factor. For contribution priors, it is the total observed outcome
(repeated for each channel.)
|
Methods
__eq__
__eq__(
other
)
Return self==value.
Class Variables |
|
media
|
None
|
|
media_scaled
|
None
|
|
media_spend
|
None
|
|
media_transformer
|
None
|
|
prior_denominator
|
None
|
|
prior_media_scaled_counterfactual
|
None
|
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 2026-02-05 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 2026-02-05 UTC."],[],["`MediaTensors` is a container for media-related tensors, including `media`, `media_spend`, `media_scaled`, and counterfactual versions. `media` and `media_spend` are derived from input data. `media_scaled` is normalized media data. Counterfactual tensors (`media_counterfactual`, `media_spend_counterfactual`, `media_counterfactual_scaled`) are used to calculate ROI based on differences in sales or spend. The `MediaTransformer` scales media tensors. The class also defines an `__eq__` method and various class variables, to define the tensor data stored.\n"]]