InferenceDataGroupSchema#

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

InferenceDataGroupSchema.copy(*[, include, ...])

Returns a copy of the model.

InferenceDataGroupSchema.dict(*[, include, ...])

InferenceDataGroupSchema.from_orm(obj)

InferenceDataGroupSchema.json(*[, include, ...])

InferenceDataGroupSchema.model_parametrized_name(params)

Compute the class name for parametrizations of generic classes.

InferenceDataGroupSchema.parse_file(path, *)

InferenceDataGroupSchema.parse_obj(obj)

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

InferenceDataGroupSchema.schema([by_alias, ...])

InferenceDataGroupSchema.schema_json(*[, ...])

InferenceDataGroupSchema.update_forward_refs(...)

InferenceDataGroupSchema.validate(value)

InferenceDataGroupSchema.validate_group(idata)

Validate group exists and contains expected variables.

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.

name

required

variables