Join the newly launched Discord
community for real-time discussions, peer support, and direct interaction with the Meridian team!
meridian.model.media.RfTensors
Stay organized with collections
Save and categorize content based on your preferences.
Container for Reach and Frequency (RF) media tensors.
meridian
.
model
.
media
.
RfTensors
(
reach
:
(
meridian
.
backend
.
Tensor
|
None
)
=
None
,
frequency
:
(
meridian
.
backend
.
Tensor
|
None
)
=
None
,
rf_impressions
:
(
meridian
.
backend
.
Tensor
|
None
)
=
None
,
rf_spend
:
(
meridian
.
backend
.
Tensor
|
None
)
=
None
,
reach_transformer
:
(
meridian
.
model
.
transformers
.
MediaTransformer
|
None
)
=
None
,
reach_scaled
:
(
meridian
.
backend
.
Tensor
|
None
)
=
None
,
prior_reach_scaled_counterfactual
:
(
meridian
.
backend
.
Tensor
|
None
)
=
None
,
prior_denominator
:
(
meridian
.
backend
.
Tensor
|
None
)
=
None
)
A MediaTransformer
to scale RF tensors using the
model's RF data.
A reach tensor normalized by population and by the median
value.
prior_reach_scaled_counterfactual
A tensor containing reach_scaled
values
corresponding to the counterfactual scenario required for the prior
calculation. For ROI priors, the counterfactual scenario is where reach is
set to zero during the calibration period. For mROI priors, the
counterfactual scenario is where reach is increased by a small factor for
all n_rf_times
. For contribution priors, the counterfactual scenario is
where reach is set to zero for all n_rf_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 rf_roi_calibration_period
is None
.
If ROI, mROI, or contribution priors are used, this
represents the denominator. It is a tensor with dimension equal to n_rf_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.
prior_reach_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 2025-09-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 2025-09-05 UTC."],[[["\u003cp\u003e\u003ccode\u003eRfTensors\u003c/code\u003e is a container for Reach and Frequency (RF) media tensors, including \u003ccode\u003ereach\u003c/code\u003e, \u003ccode\u003efrequency\u003c/code\u003e, and \u003ccode\u003erf_spend\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eIt includes attributes for scaled and counterfactual reach tensors, namely \u003ccode\u003ereach_scaled\u003c/code\u003e, \u003ccode\u003ereach_counterfactual\u003c/code\u003e, and \u003ccode\u003ereach_counterfactual_scaled\u003c/code\u003e, to handle media data variations.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003ereach_transformer\u003c/code\u003e attribute is a \u003ccode\u003eMediaTransformer\u003c/code\u003e used for scaling RF tensors with data from the model.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003erf_spend_counterfactual\u003c/code\u003e represents a tensor with media spend counterfactuals, allowing for ROI calculations based on spend differences, similar to \u003ccode\u003ereach_counterfactual\u003c/code\u003e which does it based on expected sales differences.\u003c/p\u003e\n"],["\u003cp\u003eThe class also defines an \u003ccode\u003e__eq__\u003c/code\u003e method for comparing the equality between \u003ccode\u003eRfTensor\u003c/code\u003e instances.\u003c/p\u003e\n"]]],[],null,["\u003cbr /\u003e\n\n|-----------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/google/meridian/blob/v1.2.0/meridian/model/media.py#L205-L245) |\n\nContainer for Reach and Frequency (RF) media tensors. \n\n meridian.model.media.RfTensors(\n reach: (../../../meridian/backend/Tensor.md | None) = None,\n frequency: (../../../meridian/backend/Tensor.md | None) = None,\n rf_impressions: (../../../meridian/backend/Tensor.md | None) = None,\n rf_spend: (../../../meridian/backend/Tensor.md | None) = None,\n reach_transformer: (../../../meridian/model/transformers/MediaTransformer.md | None) = None,\n reach_scaled: (../../../meridian/backend/Tensor.md | None) = None,\n prior_reach_scaled_counterfactual: (../../../meridian/backend/Tensor.md | None) = None,\n prior_denominator: (../../../meridian/backend/Tensor.md | None) = None\n )\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Attributes ||\n|-------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `reach` | A tensor constructed from [`InputData.reach`](../../../meridian/data/input_data/InputData.md#reach). |\n| `frequency` | A tensor constructed from [`InputData.frequency`](../../../meridian/data/input_data/InputData.md#frequency). |\n| `rf_impressions` | A tensor constructed from [`InputData.reach`](../../../meridian/data/input_data/InputData.md#reach) \\* [`InputData.frequency`](../../../meridian/data/input_data/InputData.md#frequency). |\n| `rf_spend` | A tensor constructed from [`InputData.rf_spend`](../../../meridian/data/input_data/InputData.md#rf_spend). |\n| `reach_transformer` | A `MediaTransformer` to scale RF tensors using the model's RF data. |\n| `reach_scaled` | A reach tensor normalized by population and by the median value. |\n| `prior_reach_scaled_counterfactual` | A tensor containing `reach_scaled` values corresponding to the counterfactual scenario required for the prior calculation. For ROI priors, the counterfactual scenario is where reach is set to zero during the calibration period. For mROI priors, the counterfactual scenario is where reach is increased by a small factor for all `n_rf_times`. For contribution priors, the counterfactual scenario is where reach is set to zero for all `n_rf_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 `rf_roi_calibration_period` is `None`. |\n| `prior_denominator` | If ROI, mROI, or contribution priors are used, this represents the denominator. It is a tensor with dimension equal to `n_rf_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). |\n\n\u003cbr /\u003e\n\nMethods\n\n`__eq__` \n\n __eq__(\n other\n )\n\nReturn self==value.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Class Variables ||\n|-----------------------------------|--------|\n| frequency | `None` |\n| prior_denominator | `None` |\n| prior_reach_scaled_counterfactual | `None` |\n| reach | `None` |\n| reach_scaled | `None` |\n| reach_transformer | `None` |\n| rf_impressions | `None` |\n| rf_spend | `None` |\n\n\u003cbr /\u003e"]]