InferenceDataGroupSchema#

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

Schema for a single InferenceData group.

Validates that a group exists (if required) and contains expected variables with correct structure.

Parameters:
nameLiteral

Group name (e.g., “posterior”, “constant_data”)

requiredbool, default True

Whether this group must be present

variablesdict of str to VariableSchema

Expected variables in this group

Examples

>>> schema = InferenceDataGroupSchema(
...     name="posterior",
...     required=True,
...     variables={
...         "channel_contribution": VariableSchema(
...             name="channel_contribution",
...             dims=("date", "channel"),
...             dtype="float64",
...         ),
...     },
... )
>>> errors = schema.validate_group(idata)

Methods

InferenceDataGroupSchema.__init__(**data)

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

InferenceDataGroupSchema.validate_group(idata)

Validate group exists and contains expected variables.

field name: Literal['posterior', 'prior', 'constant_data', 'observed_data', 'fit_data', 'posterior_predictive', 'prior_predictive', 'sample_stats', 'posterior_predictive_constant_data'] [Required][source]#
field required: bool = True[source]#
field variables: dict[str, VariableSchema] [Optional][source]#