MMMPlotSuite.cv_predictions#

MMMPlotSuite.cv_predictions(results, dims=None)[source]#

Plot posterior predictive predictions across CV folds.

Generates visualization showing posterior predictive distributions for each cross-validation fold, with separate panels for different dimension combinations.

Parameters:
resultsarviz.InferenceData

Combined InferenceData produced by TimeSliceCrossValidator.run(). Must contain:

  • A coordinate named ‘cv’

  • A ‘cv_metadata’ group with per-fold metadata (X_train, y_train, X_test, y_test) stored under cv_metadata.metadata

  • A posterior_predictive group containing ‘y_original_scale’

dimsdict, optional

Dictionary specifying dimensions to filter when plotting. Keys must be coordinates present on posterior_predictive['y_original_scale']. Values can be single values or lists of values.

Returns:
figmatplotlib.figure.Figure

The matplotlib figure object.

axesnumpy.ndarray of matplotlib.axes.Axes

Array of axes objects, one per panel.

Raises:
TypeError

If results is not an arviz.InferenceData object.

ValueError

If required groups or variables are missing from results. If unsupported dimensions are specified in dims.

See also

TimeSliceCrossValidator.run

Generate the combined InferenceData.

param_stability

Plot parameter stability across folds.

cv_crps

Plot CRPS scores across folds.

Notes

The plot shows:

  • HDI (94%) for train (blue) and test (orange) ranges as shaded bands

  • Observed values as black lines

  • A vertical dashed green line marking the end of training for each fold