View source on GitHub
|
Generates model fit plots from the Meridian model fitting.
meridian.analysis.visualizer.ModelFit(
meridian: model.Meridian,
use_kpi: bool = False,
confidence_level: float = c.DEFAULT_CONFIDENCE_LEVEL
)
Calculates the expected versus actual outcome with the confidence level over time, and plots graphs to compare the values.
Methods
plot_model_fit
plot_model_fit(
selected_times: (Sequence[str] | None) = None,
selected_geos: (Sequence[str] | None) = None,
n_top_largest_geos: (int | None) = None,
show_geo_level: bool = False,
include_baseline: bool = True,
include_ci: bool = True
) -> alt.Chart
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
update_confidence_level(
confidence_level: float
)
View source on GitHub