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 parameterseffects(optional): list of additive effects in the modelextra_vars(optional): columns passed through as xarray data variablesdata(optional): paths to X and y dataoriginal_scale_vars(optional): list of original scale variablesidata_path(optional): path to inference data
- Parameters:
- config_path
str|Path YAML file with model configuration.
- X
pandas.DataFrameorxarray.Dataset, optional Pre-loaded covariate matrix. If omitted, the loader tries to read it from a path in the YAML under
data.X_path. Whenextra_varsis set in the YAML and X is a DataFrame, it is converted to anxarray.Datasetbeforebuild_model.- y
pandas.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 anxarray.Datasetthat already contains_target(ortarget), y may be omitted.- model_kwargs
dict, optional Additional keyword arguments for the model. They override any defaults specified in the YAML config.
- config_path
- Returns:
- model
MMM
- model