MMMIdataSchema#

class pymc_marketing.data.idata.schema.MMMIdataSchema(**data)[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.construct([_fields_set])

MMMIdataSchema.copy(*[, include, exclude, ...])

Returns a copy of the model.

MMMIdataSchema.dict(*[, include, exclude, ...])

MMMIdataSchema.from_model_config([...])

Create schema based on model configuration.

MMMIdataSchema.from_orm(obj)

MMMIdataSchema.json(*[, include, exclude, ...])

MMMIdataSchema.model_parametrized_name(params)

Compute the class name for parametrizations of generic classes.

MMMIdataSchema.parse_file(path, *[, ...])

MMMIdataSchema.parse_obj(obj)

MMMIdataSchema.parse_raw(b, *[, ...])

MMMIdataSchema.schema([by_alias, ref_template])

MMMIdataSchema.schema_json(*[, by_alias, ...])

MMMIdataSchema.update_forward_refs(**localns)

MMMIdataSchema.validate(idata)

Validate InferenceData against schema.

MMMIdataSchema.validate_or_raise(idata)

Validate InferenceData, raising detailed exception if invalid.

Attributes

model_computed_fields

model_config

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_extra

Get extra fields set during validation.

model_fields

model_fields_set

Returns the set of fields that have been explicitly set on this model instance.

model_type

groups

custom_dims