MMM.add_original_scale_contribution_variable#

MMM.add_original_scale_contribution_variable(var)[source]#

Add pmd.Deterministic nodes that map model variables to original scale.

For identity-link models: variable * target_scale. For log-link models: exp(variable) * target_scale.

Warning

For log-link models, applying this to an individual component (e.g. channel_contribution) yields exp(variable) * target_scale – a bare multiplicative factor on the response scale, not that component’s incremental contribution to \(y\). Because components combine multiplicatively under the log link, a single component has no standalone additive contribution. For per-component contributions use compute_counterfactual_contributions_dataset() (or the conserving MMMIDataWrapper.get_contributions()). Applying this to the output variable (y) is fine: it gives the median prediction on the original scale.

Parameters:
varlist[str]

The variables to add the original scale contribution variable.

Examples

model.add_original_scale_contribution_variable(
    var=["channel_contribution", "total_media_contribution", "y"]
)