MMMPlotSuite.cv_crps#

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

Plot CRPS scores for train and test sets across CV splits.

Generates plots showing the Continuous Ranked Probability Score (CRPS) for each cross-validation fold, optionally stratified by additional dimensions.

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 stratify the CRPS computation. 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

2D array of axes objects with shape (n_panels, 2), where the first column shows train CRPS and the second shows test CRPS.

Raises:
TypeError

If results is not an arviz.InferenceData object.

ValueError

If required groups or variables are missing from results. If no ‘cv’ coordinate is found in the InferenceData.

See also

TimeSliceCrossValidator.run

Generate the combined InferenceData.

cv_predictions

Plot posterior predictive across folds.

param_stability

Plot parameter stability across folds.

Notes

CRPS (Continuous Ranked Probability Score) is a proper scoring rule that measures the quality of probabilistic predictions. Lower values indicate better predictions.