CounterfactualSweep.__init__#

CounterfactualSweep.__init__(mmm, X, predictors, sweep_values, sweep_type='multiplicative')[source]#

Initialize and run the counterfactual sweep.

Parameters:
- mmm: The marketing mix model instance used for predictions.
- X: Original design matrix (DataFrame).
- predictors (list[str]): List of predictors to intervene on.
- sweep_values (np.ndarray): Array of sweep values.
- sweep_type (str): ‘multiplicative’, ‘additive’, or ‘absolute’.
  • ‘multiplicative’: Multiply the original predictor values by each sweep value.

  • ‘additive’: Add each sweep value to the original predictor values.

  • ‘absolute’: Set the predictor values directly to each sweep value (ignoring original values).