MMMIdataSchema#

pydantic model pymc_marketing.data.idata.schema.MMMIdataSchema[source]#

Complete schema for multidimensional MMM InferenceData.

Defines expected groups and variables for a fitted MMM model, with configuration based on model settings.

Parameters:
model_typeLiteral[“mmm”], default “mmm”

Model type (currently only MMM supported)

groupsdict of str to InferenceDataGroupSchema

Schema for each InferenceData group

custom_dimstuple of str, default ()

Custom dimensions beyond standard (date, channel)

Examples

>>> schema = MMMIdataSchema.from_model_config(
...     custom_dims=("country",),
...     has_controls=True,
...     has_seasonality=False,
...     time_varying=False,
... )
>>> errors = schema.validate(mmm.idata)
>>> if errors:
...     print("Validation errors:", errors)

Methods

MMMIdataSchema.__init__(**data)

Create a new model by parsing and validating input data from keyword arguments.

MMMIdataSchema.from_model_config([...])

Create schema based on model configuration.

MMMIdataSchema.validate_or_raise(idata)

Validate InferenceData, raising detailed exception if invalid.

field custom_dims: tuple[str, ...] = ()[source]#

Custom dimensions beyond standard (date, channel)

field groups: dict[str, InferenceDataGroupSchema] [Required][source]#
field model_type: Literal['mmm'] = 'mmm'[source]#