meridian.analysis.visualizer.ModelFit

Generates model fit plots from the Meridian model fitting.

Calculates the expected versus actual outcome with the confidence level over time, and plots graphs to compare the values.

meridian
Media mix model with the raw data from the model fitting.
confidence_level
Confidence level for expected outcome credible intervals represented as a value between zero and one. Default is 0.9 .

model_fit_data
Dataset holding the expected, actual, and baseline outcome over time.

The dataset contains the following:

  • Coordinates: geo , time , metric ( mean , ci_hi , ci_lo )
  • Data variables: expected , baseline , actual (outcome)

Methods

plot_model_fit

View source

Plots the expected versus actual outcome over time.

Args

selected_times
Optional list of a subset of time dimensions to include. By default, all times are included. Times should match the time dimensions from meridian.InputData .
selected_geos
Optional list of a subset of geo dimensions to include. By default, all geos are included. Geos should match the geo dimension names from meridian.InputData . Set either selected_geos or n_top_largest_geos , do not set both.
n_top_largest_geos
Optional number of largest geos by population to include. By default, all geos are included. Set either selected_geos or n_top_largest_geos , do not set both.
show_geo_level
If True , plots at the geo-level instead of one national level plot. Only available if selected_geos or n_top_largest_geos is provided.
include_baseline
If True , shows the expected baseline outcome without any media execution.
include_ci
If True , shows the credible intervals for the expected outcome.

Returns
An Altair plot showing the model fit.

update_confidence_level

View source

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