MMM.add_original_scale_contribution_variable#
- MMM.add_original_scale_contribution_variable(var)[source]#
Add
pmd.Deterministicnodes 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) yieldsexp(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 usecompute_counterfactual_contributions_dataset()(or the conservingMMMIDataWrapper.get_contributions()). Applying this to the output variable (y) is fine: it gives the median prediction on the original scale.Examples
model.add_original_scale_contribution_variable( var=["channel_contribution", "total_media_contribution", "y"] )