MMMPlotSuite.param_stability#
- MMMPlotSuite.param_stability(results, parameter, dims=None)[source]#
Plot parameter stability across CV iterations.
Generates forest plots showing how parameter estimates vary across cross-validation folds, helping assess model stability.
- Parameters:
- results
arviz.InferenceData Combined InferenceData produced by
TimeSliceCrossValidator.run(). Must contain a coordinate named ‘cv’ which labels each CV fold.- parameter
listofstr List of parameter names to plot (e.g.,
["beta_channel"]).- dims
dict, optional Dictionary specifying dimensions and coordinate values to slice over. Each key is a dimension name, and the value is a list of coordinate values. A separate forest plot is generated for each combination. Example:
{"geo": ["geo_a", "geo_b"]}.
- results
- Returns:
- fig
matplotlib.figure.Figure The matplotlib figure object (last one if multiple plots generated).
- ax
matplotlib.axes.Axes The axes object (last one if multiple plots generated).
- fig
- Raises:
TypeErrorIf
resultsis not anarviz.InferenceDataobject.ValueErrorIf the InferenceData does not contain a ‘cv’ coordinate. If unable to select specified dimensions from posterior.
See also
TimeSliceCrossValidator.runGenerate the combined InferenceData.
cv_predictionsPlot posterior predictive across folds.
cv_crpsPlot CRPS scores across folds.
Examples
Basic usage:
>>> suite = MMMPlotSuite(idata=None) >>> fig, ax = suite.param_stability(combined_idata, parameter=["beta_channel"])
With dimension slicing:
>>> fig, ax = suite.param_stability( ... combined_idata, parameter=["beta_channel"], dims={"geo": ["US", "UK"]} ... )