calculate_metric_distributions#

pymc_marketing.mmm.evaluation.calculate_metric_distributions(y_true, y_pred, metrics_to_calculate=None)[source]#

Calculate distributions of evaluation metrics for posterior samples.

Parameters:
y_truenpt.NDArray | pd.Series

True values for the dataset. Shape: (date,)

y_prednpt.NDArray | xr.DataArray

Posterior predictive samples. Shape: (date, sample)

metrics_to_calculatelist of str or None, optional
List of metrics to calculate. Options include:
  • r_squared: Bayesian R-squared.

  • rmse: Root Mean Squared Error.

  • nrmse: Normalized Root Mean Squared Error.

  • mae: Mean Absolute Error.

  • nmae: Normalized Mean Absolute Error.

  • mape: Mean Absolute Percentage Error.

Defaults to all metrics if None.

Returns:
dict of str to npt.NDArray

A dictionary containing calculated metric distributions.