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_type
Literal[“mmm”], default “mmm” Model type (currently only MMM supported)
- groups
dictofstrtoInferenceDataGroupSchema Schema for each InferenceData group
- custom_dims
tupleofstr, default () Custom dimensions beyond standard (date, channel)
- model_type
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, ...])Create schema based on model configuration.
MMMIdataSchema.json(*[, include, exclude, ...])MMMIdataSchema.model_construct([_fields_set])Creates a new instance of the
Modelclass with validated data.MMMIdataSchema.model_copy(*[, update, deep])!!! abstract "Usage Documentation"
MMMIdataSchema.model_dump(*[, mode, ...])!!! abstract "Usage Documentation"
MMMIdataSchema.model_dump_json(*[, indent, ...])!!! abstract "Usage Documentation"
MMMIdataSchema.model_json_schema([by_alias, ...])Generates a JSON schema for a model class.
Compute the class name for parametrizations of generic classes.
MMMIdataSchema.model_post_init(context, /)Override this method to perform additional initialization after
__init__andmodel_construct.MMMIdataSchema.model_rebuild(*[, force, ...])Try to rebuild the pydantic-core schema for the model.
MMMIdataSchema.model_validate(obj, *[, ...])Validate a pydantic model instance.
MMMIdataSchema.model_validate_json(json_data, *)!!! abstract "Usage Documentation"
Validate the given object with string data against the Pydantic model.
MMMIdataSchema.parse_file(path, *[, ...])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.
Validate InferenceData, raising detailed exception if invalid.
Attributes
model_computed_fieldsmodel_configConfiguration for the model, should be a dictionary conforming to [
ConfigDict][pydantic.config.ConfigDict].model_extraGet extra fields set during validation.
model_fieldsmodel_fields_setReturns the set of fields that have been explicitly set on this model instance.
model_typegroupscustom_dims