log_mmm_evaluation_metrics#
- pymc_marketing.mlflow.log_mmm_evaluation_metrics(y_true, y_pred, metrics_to_calculate=None, hdi_prob=0.94, prefix='')[source]#
Log evaluation metrics produced by
pymc_marketing.mmm.evaluation.compute_summary_metrics()to MLflow.- Parameters:
y_true (
NDArray|Series) – The true values of the target variable.y_pred (
NDArray|DataArray) – The predicted values of the target variable.metrics_to_calculate (
list[str] |None) –List of metrics to calculate. If None, all available metrics will be calculated. 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.
hdi_prob (
float) – The probability mass of the highest density interval. Defaults to 0.94.prefix (
str) – Prefix to add to the metric names. Defaults to “”.
Examples
Log in-sample evaluation metrics for a PyMC-Marketing MMM model:
import mlflow from pymc_marketing.mmm import MMM mmm = MMM(...) mmm.fit(X, y) predictions = mmm.sample_posterior_predictive(X) with mlflow.start_run(): log_mmm_evaluation_metrics(y, predictions["y"])