build_mmm_from_yaml#

pymc_marketing.mmm.builders.yaml.build_mmm_from_yaml(config_path, *, X=None, y=None, model_kwargs=None)[source]#

Build an MMM model from config_path.

The configuration keys:

  • model (required): MMM initialization parameters

  • effects (optional): list of additive effects in the model

  • extra_vars (optional): columns passed through as xarray data variables

  • data (optional): paths to X and y data

  • original_scale_vars (optional): list of original scale variables

  • idata_path (optional): path to inference data

Parameters:
config_pathstr | Path

YAML file with model configuration.

Xpandas.DataFrame or xarray.Dataset, optional

Pre-loaded covariate matrix. If omitted, the loader tries to read it from a path in the YAML under data.X_path. When extra_vars is set in the YAML and X is a DataFrame, it is converted to an xarray.Dataset before build_model.

ypandas.DataFrame | pandas.Series, optional

Pre-loaded target vector. If omitted, the loader tries to read it from a path in the YAML under data.y_path. When X is an xarray.Dataset that already contains _target (or target), y may be omitted.

model_kwargsdict, optional

Additional keyword arguments for the model. They override any defaults specified in the YAML config.

Returns:
modelMMM