meridian.model.eda.meridian_eda.MeridianEDA

Handles EDA report generation and visualization for a Meridian model.

meridian Meridian object.
n_draws_prior Number of draws for prior distribution check. Only used if no prior samples exist in meridian.inference_data.
seed Seed for prior distribution check. Only used if no prior samples exist in meridian.inference_data.

critical_outcomes

eda_engine

geo_cost_per_media_unit_check_outcome

geo_pairwise_correlation_check_outcome

geo_stdev_check_outcome

national_cost_per_media_unit_check_outcome

national_pairwise_correlation_check_outcome

national_stdev_check_outcome

Methods

generate_and_save_report

View source

Generates and saves a HTML report containing EDA findings.

Args
filename The filename for the generated HTML output.
filepath The path to the directory where the file will be saved.

plot_controls_and_non_media_boxplot

View source

Plots the boxplots for controls and non-media treatments variation.

plot_cost_per_media_unit_time_series

View source

Plots cost per media unit time series for paid media channels.

Args
geos The geos to plot.
channels The channels to plot. If None, plots all channels.

Returns
The cost per media unit time series plot and the superimposed cost with media unit time series plot for each paid media channel.

plot_kpi_boxplot

View source

Plots the boxplot for KPI variation.

plot_national_kpi_with_knots_time_series

View source

Plots the national scaled KPI with knots time series plot.

plot_pairwise_correlation

View source

Plots the Pairwise Correlation data.

Args
geos Defines which geos to plot. - int: The number of top geos to plot, ranked by population. - Sequence[str]: A specific sequence of geo names to plot. - 'nationalize': Aggregates all geos into a single national view. Defaults to 1 (plotting the top geo). If the data is already at a national level, this parameter is ignored and a national plot is generated.
max_vars The maximum number of variables to include in the correlation heatmap. Variables are selected based on their absolute correlation values. If None, all variables are included.

Returns
Altair chart(s) of the Pairwise Correlation data.

Raises
ValueError If max_vars is less than or equal to 1.

plot_population_raw_media_correlation

View source

Plots Spearman correlation between population and raw media units.

Returns
A bar chart showing the correlation.

Raises
eda_engine_module.GeoLevelCheckOnNationalModelError If the Meridian model is national.

plot_population_treatment_correlation

View source

Plots the Spearman correlation of population vs treatments or controls.

Returns
An Altair chart showing the correlation.

Raises
eda_engine_module.GeoLevelCheckOnNationalModelError If the Meridian model is national.

plot_prior_mean

View source

Plots the prior mean of contribution by channel.

Returns
A bar chart showing the prior mean of contribution by channel.

Raises
eda_engine_module.GeoLevelCheckOnNationalModelError If the Meridian model is national.

plot_relative_impression_share_barchart

View source

Plots a bar chart of the relative impression share per media channel.

Args
geos The geos to plot.
n_channels The number of channels to display by impression share. If None, displays all channels.
ascending Whether to sort the channels in ascending order by impression share.

Returns
The bar chart of the relative impression share of each media channel.

plot_relative_spend_share_barchart

View source

Plots a bar chart of the relative spend share per paid media channel.

Args
geos The geos to plot.
n_channels The number of channels to display by spend share. If None, displays all channels.
ascending Whether to sort the channels in ascending order by spend share.

Returns
The bar chart of the relative spend share of each paid media channel.

plot_treatments_without_non_media_boxplot

View source

Plots the boxplot for treatments variation, excluding non-media.