MADMod
MADMod(self,
bandit,
alpha,
delta,
t_star,=lambda x: 1 / np.sqrt(x),
decay=None,
model=1,
n_warmup=True,
pooled )
This class implements Power-adjusted MAD (MADMod; Molitor and Gold, 2025).
Parameters
Name | Type | Description | Default |
---|---|---|---|
bandit | pyssed.Bandit | This object must implement several crucial methods/attributes. For more details on how to create a custom Bandit object, see the documentation of the Bandit class. | required |
alpha | float | The size of the statistical test (testing for non-zero treatment effects) | required |
delta | Callable[[int], float] | A function that generates the real-valued sequence delta_t in Liang and Bojinov (Definition 4 - Mixture Adaptive Design). This sequence should converge to 0 slower than 1/t^(1/4) where t denotes the time frame in {0, … n}. This function should intake an integer (t) and output a float (the corresponding delta_t) | required |
t_star | int | The time-step at which we want to optimize the CSs to be tightest. E.g. Liang and Bojinov set this to the max horizon of their experiment. | required |
decay | Callable[[int], float] | decay() should intake the current time step t and output a value in [0, 1] where 1 represents no decay and 0 represents complete decay. This function is similar to the delta() argument above. However, delta() determines the amount of random exploration in the MAD algorithm at time t. In contrast, decay() is a time-decreasing function that determines how quickly the bandit assignment probabilities for arm k decay to 0 once arm k’s ATE (ATE_k) is statistically significant. Setting a constant decay = lambda _: 1 makes this method identical to the vanilla MAD design. In contrast, decay = lambda _: 0 is the same as setting the bandit probabilities for arm k to 0 as soon as it has a significant ATE. |
lambda x: 1 / np.sqrt(x) |
model | Model | (Optional) The model class used to estimated the outcome models. This is only relevant when using covariate adjustment. | None |
n_warmup | int | The number of units (t) to collect before constructing CSs and estimating the outcome models. This is only relevant when using covariate adjustment. | 1 |
pooled | bool | Whether the outcome models should be estimated separately for each treatment arm or if a single, pooled model should be estimated. This is only relevant when using covariate adjustment. | True |
Attributes
Name | Type | Description |
---|---|---|
_weights | Dict[int, float] | These weights are calculated by decay() . Each arm has a weight. When an arm has a weight of 1, its bandit assignment probabilities are not adjusted. Once an arm is statistically significant, its weight begins to decay towards 0, and so does its bandit assignment probabilities. As an arm’s weight decays, it “shifts” its probability onto currently under-powered arms. This iterative procedure continues to focus more sample on under-powered arms until either all arms have significant ATEs or the experiment has ended. |
Notes
See the documentation for pyssed.mad.MADBase
for details on the majority of the provided methods.
Methods
Name | Description |
---|---|
pull | Perform one full iteration of the modified MAD algorithm |
pull
=True, cs_precision=0.1, mc_adjust='Bonferroni') MADMod.pull(early_stopping
Perform one full iteration of the modified MAD algorithm