ControlEffect#
- class pymc_marketing.mmm.additive_effect.ControlEffect(**data)[source]#
Additive effect for control variables in the MMM.
Encapsulates the control column logic so that control variables are handled through the
MuEffectprotocol rather than as inline code insidebuild_model.- Parameters:
- prior
Prior, optional The prior distribution for the
gamma_controlcoefficients. If"control"is absent from the prior’sdimsit is automatically added so each control column receives its own independent coefficient. Defaults toNormal(mu=0, sigma=2, dims="control").- date_dim_name
str, optional The name of the date dimension in the model. Default is
"date".
- prior
Examples
Standalone usage (the MMM wires this automatically when
control_columnsis provided, but you can also construct it explicitly):from pymc_extras.prior import Prior from pymc_marketing.mmm.additive_effect import ControlEffect effect = ControlEffect( prior=Prior("Normal", mu=0, sigma=1, dims="control"), )
Methods
ControlEffect.__init__(**data)Create a new model by parsing and validating input data from keyword arguments.
ControlEffect.construct([_fields_set])ControlEffect.copy(*[, include, exclude, ...])Returns a copy of the model.
ControlEffect.create_data(mmm[, X])Register control data in the PyMC model.
Create the control contribution deterministic in the model.
ControlEffect.dict(*[, include, exclude, ...])ControlEffect.from_dict(data)Reconstruct from a dict.
ControlEffect.json(*[, include, exclude, ...])ControlEffect.model_construct([_fields_set])Creates a new instance of the
Modelclass with validated data.ControlEffect.model_copy(*[, update, deep])!!! abstract "Usage Documentation"
ControlEffect.model_dump(*[, mode, include, ...])!!! abstract "Usage Documentation"
ControlEffect.model_dump_json(*[, indent, ...])!!! abstract "Usage Documentation"
ControlEffect.model_json_schema([by_alias, ...])Generates a JSON schema for a model class.
Compute the class name for parametrizations of generic classes.
ControlEffect.model_post_init(context, /)Override this method to perform additional initialization after
__init__andmodel_construct.ControlEffect.model_rebuild(*[, force, ...])Try to rebuild the pydantic-core schema for the model.
ControlEffect.model_validate(obj, *[, ...])Validate a pydantic model instance.
ControlEffect.model_validate_json(json_data, *)!!! abstract "Usage Documentation"
Validate the given object with string data against the Pydantic model.
ControlEffect.parse_file(path, *[, ...])ControlEffect.parse_raw(b, *[, ...])ControlEffect.schema([by_alias, ref_template])ControlEffect.schema_json(*[, by_alias, ...])ControlEffect.set_data(mmm, model, X)Update control data for new predictions.
ControlEffect.to_dict([_orig])Serialize to a dict via Pydantic model_dump.
ControlEffect.update_forward_refs(**localns)ControlEffect.validate(value)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.
priordate_dim_name