LogLinkSpec.create_total_response_deterministic#

LogLinkSpec.create_total_response_deterministic(mu_var, target_scale)[source]#

Register total_response_original_scale.

The total predicted response (original scale, scalar per draw), computed via original_scale_transform() so it is correct for every link. Because mu_var already includes every additive mu-effect, this is the natural objective for optimizing an effect’s lever, or a mediated funnel path, jointly with media (BudgetOptimizer with response_variable="total_response_original_scale").

The result is a scalar: the sum reduces every dimension, so a model with extra dims (geo, product) totals across all of them. That is the right contract for a single shared budget, and the wrong one if segments hold separate budgets – those want a per-segment objective and a constraint per segment.

Parameters:
mu_varXTensorVariable

The finalized linear predictor, including every mu effect.

target_scaleXTensorVariable

The target scaling factor.

Warning

Unlike total_media_contribution_original_scale, this quantity includes the (approximately constant) baseline response. For the default mean utility the argmax is unchanged, but a risk-adjusted utility function shifts the mean/variance trade-off, so those should prefer a media or effect contribution response variable. In an optimization model the sum also runs over the full date coord, which includes the adstock_periods carry-over tail, so an event window landing in that tail would be optimized against periods outside the intended plan.

This is a response total, not a media attribution: for the direct-versus-mediated decomposition see Incrementality, which computes proper counterfactuals.

Under the log link this sums exp(mu) * target_scale, the conditional median rather than the mean; mean_correction() is the factor between them. The argmax is unaffected, since that factor is per-draw and budget-independent, but a reader taking the value itself as the expected response is off by it.