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_construct([...])

Creates a new instance of the Model class with validated data.

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

!!! abstract "Usage Documentation"

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

!!! abstract "Usage Documentation"

InferenceDataGroupSchema.model_dump_json(*)

!!! abstract "Usage Documentation"

InferenceDataGroupSchema.model_json_schema([...])

Generates a JSON schema for a model class.

InferenceDataGroupSchema.model_parametrized_name(params)

Compute the class name for parametrizations of generic classes.

InferenceDataGroupSchema.model_post_init(...)

Override this method to perform additional initialization after __init__ and model_construct.

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

Try to rebuild the pydantic-core schema for the model.

InferenceDataGroupSchema.model_validate(obj, *)

Validate a pydantic model instance.

InferenceDataGroupSchema.model_validate_json(...)

!!! abstract "Usage Documentation"

InferenceDataGroupSchema.model_validate_strings(obj, *)

Validate the given object with string data against the Pydantic model.

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