liveBook · Manning

Stochastic intervention

As explained in Causal AI

A stochastic intervention is an intervention that assigns or changes variables according to a probability distribution rather than fixing them to a single value.

Suppose an experimentation platform must decide which players receive a high-engagement game experience. It can assign everyone the same setting, flip a coin for each player, or choose a setting using information about the player. The latter two choices require modeling how an assignment process selects the intervention value—not just what happens when the value is fixed. section 7.5.1 section 7.5.2

A stochastic intervention sets its target to a value produced by a random process rather than a single fixed value. It generalizes an ideal intervention, which fixes the target to a specified value and removes the influence of its original causal parents. The selection process may itself depend on other variables; that dependence matters when interpreting the resulting data. section 7.5 section 7.7

Random assignment versus assignment by login time

A platform randomly assigns players to high or low side-quest engagement by digitally flipping a coin. This stochastic intervention removes incoming causal influences on the assigned engagement level, including influences from unknown common causes. Assigning the first 500 players to one group and the next 500 to the other might block a path in an assumed causal DAG, yet leave bias if login time affects both engagement and purchases. Randomization is valuable because it remains effective when that assumed DAG omits such a cause. section 7.5.1

Figure 7.11 An intervention that sets the level of Side-Quest Engagement based on login time changes, but doesn’t eliminate, the causal relationship T→E. In contrast, randomization eliminates incoming edges to E.
figure

Compare assignment based on login time with random assignment: the former changes how login time influences engagement, while the latter removes that incoming influence. section 7.5.1

A decision policy is another assignment process: it takes observed state as input and selects an action. When action selection involves randomness, it is a stochastic intervention. In a causal DAG, deploying a context-dependent policy removes the action variable’s original incoming edges but creates a new route of influence through the context used by the policy. A policy can therefore break one backdoor path while leaving another that requires adjustment. section 7.5.2 section 12.4 section 12.4.2

Figure 12.23 The dashed lines show edges modulated by the policy. The policy breaks the influence of the confounder Z like an ideal intervention, but dependence on C remains through the policy.
figure

The before-and-after policy DAG distinguishes a confounder’s severed influence from the context dependence introduced by policy-driven action selection. section 12.4

Implementation must match the intended intervention. An ideal intervention in a causal graphical model needs graph surgery and a replacement causal Markov kernel that assigns all probability to the chosen value. In pgmpy, BayesianNetwork.do performs graph surgery but replaces the target’s factor with its distribution after marginalizing over its original parents—not a fixed-value, degenerate factor. Additional code is needed when a fixed-value ideal intervention is intended. section 7.2.5

How Causal AI covers it

How deep it goes
Explains random assignment, policy-induced DAG changes, residual confounding, and pgmpy’s replacement-kernel behavior.
Examples
Contrasts coin-flip assignment with login-time assignment in a gaming experiment and traces context-dependent policy effects through a DAG.
What you can do after
Diagnose/debug with it whether an assignment removes incoming causal influence or leaves context-dependent backdoor confounding.
How it connects
Connects ideal interventions and causal DAGs to randomization, backdoor paths, bandit algorithms, and reinforcement learning.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Causal AI. The section links point to the parts of the book it draws on.