InferenceDataGroupSchema#
- class pymc_marketing.data.idata.schema.InferenceDataGroupSchema(*, name, required=True, variables=<factory>)[source]#
Schema for a single DataTree group.
Validates that a group exists (if required) and contains expected variables with correct structure.
- Parameters:
name (
Literal['posterior','prior','constant_data','observed_data','fit_data','posterior_predictive','prior_predictive','sample_stats','posterior_predictive_constant_data']) – Group name (e.g., “posterior”, “constant_data”)required (
bool) – Whether this group must be presentvariables (
dict[str,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
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, ...])Compute the class name for parametrizations of generic classes.
InferenceDataGroupSchema.parse_file(path, *)InferenceDataGroupSchema.parse_raw(b, *[, ...])InferenceDataGroupSchema.schema([by_alias, ...])InferenceDataGroupSchema.schema_json(*[, ...])Validate group exists and contains expected variables.
Attributes
Configuration for the model, should be a dictionary conforming to [
ConfigDict][pydantic.config.ConfigDict].