Ref#
- class pymc_marketing.terms.Ref(name)[source]#
Reference an already-built named variable in the active model.
Lets an effect expression composed outside the model depend on another built effect (e.g.
aon thea_scaledeterministic) without recreating its variables.Refresolves at build time and requires the referenced term to be built earlier in traversal order - build once withNamed, reference afterwards withRef.Refcontributes no coordinates of its own: coordinates must come from the other leaves in the composition or be supplied by the enclosing model.- Parameters:
name (
str) – Name of the referenced variable.
Examples
scale = Named("scale", Parameter("raw", prior=Prior("HalfNormal"))) effect = Named("effect", Ref("scale") * other_term)
Methods
Ref.__init__(name)Ref.add_coords(ds)Add coordinates to the model during
register_data.Resolve the referenced variable from the active model.
Ref.from_dict(data)Reconstruct a reference from its serialized form.
Ref.get_coords(ds)Return coordinates needed for this term.
Ref.named(name[, dims])Record this expression as a named deterministic model variable.
Register shared data variables as
pmd.Data.Ref.set_data(ds[, model])Update shared data variables for out-of-sample prediction.
Ref.sum(dim)Sum this expression over one named dimension.
Ref.to_dict([_orig])Attributes
Dataset variables this term reads as shared data.
Deterministics this term freezes for out-of-sample evaluation.