Skip to main content

do_intervention

Function do_intervention 

Source
pub fn do_intervention(
    graph: &[NQuin],
    intervention_var: u64,
    intervention_value: u64,
    target_var: u64,
) -> Option<f64>
Expand description

Causal intervention operator for do-calculus Implements P(Y | do(X = x)) by intervening on the causal graph.

The do-calculus intervention do(X = x) severs X from its parents (removes incoming edges to X) while preserving X’s outgoing causal edges so that X can still influence downstream variables. We mark the intervention on the relevant quins with DO_INTERVENTION_BIT but do NOT overwrite the structural object field (which encodes the causal successor, not X’s value). The intervention_value is recorded in metadata so callers can inspect it; path existence is used as the evidence of causal effect.