Join the newly launched Discord
community for real-time discussions, peer support, and direct interaction with the Meridian team!
meridian.analysis.visualizer.ReachAndFrequency
Stay organized with collections
Save and categorize content based on your preferences.
Generates reach and frequency plots for the Meridian model.
meridian
.
analysis
.
visualizer
.
ReachAndFrequency
(
meridian
:
meridian
.
model
.
model
.
Meridian
,
selected_times
:
(
Sequence
[
str
]
|
None
)
=
None
,
use_kpi
:
(
bool
|
None
)
=
None
)
Plots the ROI by frequency for reach and frequency (RF) channels.
Media mix model with the raw data from the model fitting.
Optional list containing a subset of times to include. By
default, all time periods are included.
If True
, KPI is used instead of revenue.
Dataset holding the calculated optimal reach and frequency metrics.
The dataset contains the following:
- Coordinates:
frequency
, rf_channel
, metric
( mean
, ci_hi
, ci_lo
)
- Data variables:
roi
, optimal_frequency
Methods
plot_optimal_frequency
View source
plot_optimal_frequency
(
selected_channels
:
(
list
[
str
]
|
None
)
=
None
)
Plots the optimal frequency curves for selected channels.
selected_channels
Optional list of RF channels to plot.
A faceted Altair plot showing a curve of the optimal frequency for the
RF channels.
update_optimal_reach_and_frequency_selected_times
View source
update_optimal_reach_and_frequency_selected_times
(
selected_times
:
(
Sequence
[
str
]
|
None
)
=
None
)
Updates the selected times for optimal reach and frequency data.
selected_times
Optional list containing a subset of times to include. By
default, all time periods are included.
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\u003eThis module generates reach and frequency plots for the Meridian media mix model, visualizing ROI by frequency for specified channels.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eReachAndFrequency\u003c/code\u003e function allows users to specify a media mix model, select a subset of time periods, and choose whether to use KPI instead of revenue for analysis.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eoptimal_frequency_data\u003c/code\u003e attribute provides a dataset with metrics like ROI and optimal frequency, broken down by frequency, RF channel, and metric type.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eplot_optimal_frequency\u003c/code\u003e method generates a plot showing the optimal frequency curves for user-specified RF channels.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eupdate_optimal_reach_and_frequency_selected_times\u003c/code\u003e method enables users to update the subset of time periods included in the optimal reach and frequency analysis.\u003c/p\u003e\n"]]],[],null,["\u003cbr /\u003e\n\n|-------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/google/meridian/blob/v1.2.0/meridian/analysis/visualizer.py#L631-L834) |\n\nGenerates reach and frequency plots for the Meridian model. \n\n meridian.analysis.visualizer.ReachAndFrequency(\n meridian: ../../../meridian/model/model/Meridian.md,\n selected_times: (Sequence[str] | None) = None,\n use_kpi: (bool | None) = None\n )\n\nPlots the ROI by frequency for reach and frequency (RF) channels.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ||\n|------------------|---------------------------------------------------------------------------------------------------|\n| `meridian` | Media mix model with the raw data from the model fitting. |\n| `selected_times` | Optional list containing a subset of times to include. By default, all time periods are included. |\n| `use_kpi` | If `True`, KPI is used instead of revenue. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Attributes ||\n|--------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `optimal_frequency_data` | Dataset holding the calculated optimal reach and frequency metrics. \u003cbr /\u003e The dataset contains the following: - Coordinates: `frequency`, `rf_channel`, `metric` (`mean`, `ci_hi`, `ci_lo`) - Data variables: `roi`, `optimal_frequency` |\n\nMethods\n\n`plot_optimal_frequency`\n\n[View source](https://github.com/google/meridian/blob/v1.2.0/meridian/analysis/visualizer.py#L736-L834) \n\n plot_optimal_frequency(\n selected_channels: (list[str] | None) = None\n )\n\nPlots the optimal frequency curves for selected channels.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ||\n|---------------------|---------------------------------------|\n| `selected_channels` | Optional list of RF channels to plot. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ||\n|---|---|\n| A faceted Altair plot showing a curve of the optimal frequency for the RF channels. ||\n\n\u003cbr /\u003e\n\n`update_optimal_reach_and_frequency_selected_times`\n\n[View source](https://github.com/google/meridian/blob/v1.2.0/meridian/analysis/visualizer.py#L680-L693) \n\n update_optimal_reach_and_frequency_selected_times(\n selected_times: (Sequence[str] | None) = None\n )\n\nUpdates the selected times for optimal reach and frequency data.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ||\n|------------------|---------------------------------------------------------------------------------------------------|\n| `selected_times` | Optional list containing a subset of times to include. By default, all time periods are included. |\n\n\u003cbr /\u003e"]]