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:
- name
Literal Group name (e.g., “posterior”, “constant_data”)
- requiredbool, default
True Whether this group must be present
- variables
dictofstrtoVariableSchema Expected variables in this group
- name
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
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.json(*[, include, ...])Creates a new instance of the
Modelclass with validated data.InferenceDataGroupSchema.model_copy(*[, ...])!!! abstract "Usage Documentation"
InferenceDataGroupSchema.model_dump(*[, ...])!!! abstract "Usage Documentation"
!!! abstract "Usage Documentation"
Generates a JSON schema for a model class.
Compute the class name for parametrizations of generic classes.
Override this method to perform additional initialization after
__init__andmodel_construct.InferenceDataGroupSchema.model_rebuild(*[, ...])Try to rebuild the pydantic-core schema for the model.
Validate a pydantic model instance.
!!! abstract "Usage Documentation"
Validate the given object with string data against the Pydantic model.
InferenceDataGroupSchema.parse_file(path, *)InferenceDataGroupSchema.parse_raw(b, *[, ...])InferenceDataGroupSchema.schema([by_alias, ...])InferenceDataGroupSchema.schema_json(*[, ...])Validate group exists and contains expected variables.
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.
namerequiredvariables