meridian.analysis.visualizer.MediaEffects

Generates media effects plots for the Meridian model.

Plots incremental outcome and effectiveness for all channels.

meridian
Media mix model with the raw data from the model fitting.
by_reach
For the channel w/ reach and frequency, return the response curves by reach given fixed frequency if true; return the response curves by frequency given fixed reach if false.

Methods

adstock_decay_dataframe

View source

A DataFrame holding the calculated Adstock decay metrics.

The DataFrame contains the following columns:

time_units , channel , distribution , mean , ci_lo , ci_hi . Args: confidence_level: Confidence level for modeled adstock decay credible intervals, represented as a value between zero and one. Default is 0.9.

Returns
A DataFrame displaying the adstock decay metrics.

hill_curves_dataframe

View source

A DataFrame holding the calculated Hill curve metrics.

The DataFrame contains the following columns: channel , media_units , ci_hi , ci_lo , mean , channel_type , scaled_count_histogram , start_interval_histogram , end_interval_histogram . Args: confidence_level: Confidence level for modeled hill curves credible intervals, represented as a value between zero and one. Default is 0.9.

Returns
Hill curves pd.DataFrame with columns:
  • channel : media or rf channel name.
  • media_units : Media (for media channels) or average frequency (for rf channels) units.
  • distribution : Indication of posterior or prior draw.
  • ci_hi : Upper bound of the credible interval of the value of the Hill function.
  • ci_lo : Lower bound of the credible interval of the value of the Hill function.
  • mean : Point-wise mean of the value of the Hill function per draw.
  • channel_type : Indication of a media or rf channel.
  • scaled_count_histogram : Scaled count of media units or average frequencies within the bin.
  • count_histogram : Count value of media units or average frequencies within the bin.
  • start_interval_histogram : Media unit or average frequency starting point for a histogram bin.
  • end_interval_histogram : Media unit or average frequency ending point for a histogram bin.

plot_adstock_decay

View source

Plots the Adstock decay for each channel.

Args

confidence_level
Confidence level to update to for the adstock decay credible intervals, represented as a value between zero and one.
include_ci
If True , plots the credible interval. Defaults to True .

Returns
An Altair plot showing the Adstock decay prior and posterior per media.

plot_hill_curves

View source

Plots the Hill curves for each channel.

Args

confidence_level
Confidence level to update to for the hill curves credible intervals, represented as a value between zero and one.
include_prior
If True , plots contain both the prior and posterior. Defaults to True .
include_ci
If True , plots the credible interval. Defaults to True .

Returns
A dictionary mapping channel type constants ( media , rf , organic_media , and organic_rf ) to their respective Altair chart objects. Keys are only present if charts for that type were generated (i.e., if the corresponding channels exist in the data). Returns an empty dictionary if no relevant channels are found.

plot_response_curves

View source

Plots the response curves for each channel.

To avoid congestion when the channels are plotted in the same graph, we cap the number of channels that can be displayed visually on the graph to 7 channels maximum. If the num_channels_displayed is greater than the total number of channels in the dataset, the total number of channels in the dataset is displayed.

Args

confidence_level
Confidence level to update to for the response curve credible intervals, represented as a value between zero and one.
selected_times
Optional list containing a subset of time dimensions to include. The x-axis corresponds to spend within these time periods. The y-axis corresponds to the incremental outcome generated within these time periods under the counterfactual where media units in each geo and time period are multiplied by the corresponding multiplier (including time periods prior to to selected_times ). By default, all time periods are included.
by_reach
For the channel w/ reach and frequency, return the response curves by reach given fixed frequency if true; return the response curves by frequency given fixed reach if false.
plot_separately
If True , the plots are faceted. If False , the plots are layered to create one plot with all of the channels.
include_ci
If True , plots the credible interval. Defaults to True .
num_channels_displayed
Number of channels to show on the layered plot. If plotting a faceted chart, this value is ignored.

Returns
An Altair plot showing the response curves per channel.

response_curves_data

View source

Dataset holding the calculated response curves data.

The dataset contains the following:

  • Coordinates: media , metric ( mean , ci_hi , ci_lo ), spend_multiplier
  • Data variables: spend , incremental_outcome , roi

Args

confidence_level
Confidence level for modeled response credible intervals, represented as a value between zero and one. Default is 0.9.
selected_times
Optional list containing a subset of time dimensions to include. The x-axis corresponds to spend within these time periods. The y-axis corresponds to the incremental outcome generated within these time periods under the counterfactual where media units in each geo and time period are scaled by the ratio of x-axis spend to historical spend. (Media units for time periods prior to to selected_times are also scaled by this ratio). By default, all times are included. Times should match the time dimensions from meridian.InputData .
by_reach
For the channel w/ reach and frequency, return the response curves by reach given fixed frequency if true; return the response curves by frequency given fixed reach if false.

Returns
A Dataset displaying the response curves data.

Design a Mobile Site
View Site in Mobile | Classic
Share by: