Generates model diagnostics plots from the Meridian model fitting.
meridian
.
analysis
.
visualizer
.
ModelDiagnostics
(
meridian
:
meridian
.
model
.
model
.
Meridian
,
use_kpi
:
bool
=
False
)
Methods
plot_prior_and_posterior_distribution
plot_prior_and_posterior_distribution
(
parameter
:
str
=
'roi_m'
,
num_geos
:
int
=
3
,
selected_times
:
(
list
[
str
]
|
None
)
=
None
)
->
(
alt
.
Chart
|
alt
.
FacetChart
)
Plots prior and posterior distributions for a model parameter.
parameter
num_geos
selected_times
NotFittedModelError
ValueError
parameter
is not a Meridian model parameter. plot_rhat_boxplot
plot_rhat_boxplot
()
->
alt
.
Chart
Plots the R-hat box plot.
Visual summary of the Gelman & Rubin (1992) potential scale reduction for chain convergence, commonly referred to as R-hat. It is a convergence diagnostic measure that measures the degree to which variance (of the means) between chains exceeds what you would expect if the chains were identically distributed. Values close to 1.0 indicate convergence. R-hat < 1.2 indicates approximate convergence and is a reasonable threshold for many problems (Brooks & Gelman, 1998).
There is a single R-hat value for each model parameter. The box plot
summarizes the distribution of R-hat values across indices. For example, the
box corresponding to beta_gm
summarizes the distribution of R-hat values
across both the geo index g
and the channel index m
.
The R-hat is not defined for any parameters that have deterministic priors, so these parameters are not shown on the boxplot.
NotFittedModelError
MCMCSamplingError
predictive_accuracy_table
predictive_accuracy_table
(
selected_geos
:
(
Sequence
[
str
]
|
None
)
=
None
,
selected_times
:
(
Sequence
[
str
]
|
None
)
=
None
,
column_var
:
(
str
|
None
)
=
None
,
batch_size
:
int
=
c
.
DEFAULT_BATCH_SIZE
)
->
pd
.
DataFrame
Displays the predictive accuracy of the DataFrame.
selected_geos
meridian.InputData
. Set either selected_geos
or n_top_largest_geos
, do not set both.selected_times
meridian.InputData
.column_var
metric
, geo_granularity
or evaluation_set
. By default, column_var=None
indicates that the metric
, geo_granularity
and value
(along with evaluation_set
when holdout_id
isn't None
)
columns are displayed in the returning unpivoted DataFrame.batch_size
batch_size
. The
calculation will generally be faster with larger batch_size
values.
R_Squared
, MAPE
and wMAPE
values. If holdout_id
exists, the data is split into Train
, Test
,
and All Data
subsections, and evaluation_set
is included as a column
in the transformation from Dataset to DataFrame.


