Explanation: Optimisation Concepts
This page explains how AMMM converts posterior model outputs into budget allocation decisions under constraints.
Where Optimisation Sits in the Workflow
Section titled “Where Optimisation Sits in the Workflow”Optimisation is a late-stage decision layer. It should be interpreted only after pre-diagnostics, convergence, calibration, and model assessment are acceptable.
See Workflow Stages for stage dependencies.
Response-Curve Approximation Used for Optimisation
Section titled “Response-Curve Approximation Used for Optimisation”AMMM builds channel-level spend-to-contribution functions from fitted model outputs. In practice:
- Fit the Bayesian MMM and derive channel contribution series.
- Fit smooth saturating response curves to spend–contribution pairs.
- Optimise allocations under constraints using those response curves.
Implementation uses curve_fit-based parameter estimation in core.utils.estimate_sigmoid_parameters and core.utils.estimate_menten_parameters.
Objective Structure
Section titled “Objective Structure”For single-period optimisation, the objective is to maximise total expected contribution:
$$ \max_{S_1,\dots,S_n} \sum_{i=1}^{n} C_i(S_i) $$
subject to budget and bound constraints.
With fixed total budget, maximising contribution is equivalent to maximising return efficiency under that budget envelope.
Constraints
Section titled “Constraints”AMMM supports the following constraint families:
- Total budget:
$$ \sum_{i=1}^{n} S_i = B $$
- Channel bounds:
$$ S_i^{\min} \le S_i \le S_i^{\max} $$
- Ramp constraints (multi-period): period-to-period change limits by channel, with both:
- absolute ramps, and
- percentage ramps.
Ramp constraints are parsed and validated by parse_and_validate_ramp_constraints.
Solvers and Multi-Period Modes
Section titled “Solvers and Multi-Period Modes”Single period
Section titled “Single period”- Solver:
scipy.optimize.minimizewithSLSQP.
Multi-period
Section titled “Multi-period”AMMM supports two operational modes:
- Simultaneous optimisation across all periods (default numerical method is
SLSQP, withtrust-constrused for larger problems). - Sequential optimisation (greedy period-by-period), which is often more numerically robust for difficult constrained cases.
Adstock-aware objective
Section titled “Adstock-aware objective”An adstock-aware multi-period objective is implemented (objective_multiperiod_with_adstock) for advanced use cases. It increases non-linearity and should be treated as an advanced option.
Uncertainty: What Is and Is Not Propagated
Section titled “Uncertainty: What Is and Is Not Propagated”Current V2 behaviour is pragmatic:
- Optimisation typically runs on fitted response-curve parameters (often posterior-mean based summaries).
- This is not a full posterior expected-utility optimiser by default.
- Uncertainty is still available for decision context via posterior diagnostics, decomposition intervals, and response-curve analysis artefacts.
So optimisation outputs should be read as policy recommendations under model-estimated response surfaces, not certainty-equivalent truths.
Risk-aware utility formulations (for example explicit quantile utility or penalty-based robust utility) are conceptually useful but are not exposed as distinct first-class objective modes in current V2 APIs.
Output Artefacts
Section titled “Output Artefacts”Primary outputs are written to 70_optimisation/:
optimization_results.csvbudget_scenario_results.csvmultiperiod_optimization_results.csvbudget_optimisation.png- scenario and multi-period visual diagnostics
These should be interpreted together with diagnostic artefacts in 50_diagnostics/.
Practical Interpretation Rules
Section titled “Practical Interpretation Rules”- Treat optimisation as conditional on model adequacy.
- Validate recommendations against bounds and ramp feasibility.
- Compare scenario outputs rather than relying on a single point allocation.
- Communicate uncertainty and assumptions explicitly.
Causal Caveat
Section titled “Causal Caveat”Optimisation quality depends on model structure and assumptions. Even when diagnostics pass, results are associational decision support unless stronger identification evidence is available.