to_mmm_dataset#
- pymc_marketing.mmm.data_conversion.to_mmm_dataset(X, y=None, *, date_column, dims=(), channel_columns, control_columns=None, target_column=None)[source]#
Normalise X (and optionally y) to a single canonical
xr.Dataset.This is the sole entry point for data normalisation in the MMM pipeline. It handles all supported input type combinations and returns a dataset with the canonical underscore-prefixed variable names (
_channel,_target,_control).- Parameters:
- X
Feature data.
- y
Target variable. When X is already an
xr.Datasetthat contains atarget/_targetdata variable this may be omitted.- date_column
Name of the date column in a
pd.DataFrameinput.- dims
Extra dimension names (e.g.
("geo",)).- channel_columns
Names of the media-channel columns.
- control_columns
Names of control-variable columns.
- target_column
Name of the target / response variable.
- Returns:
xr.DatasetDataset with variables
_channel, (optional)_target, and (optional)_controland coordinates for each dimension.