chc.flagship¶
Stability tier: experimental.
Flagship: causal vs predictive control under confounding — the sign-flip catastrophe.
Offline data is logged under a behaviour policy that ties the action to a confounder z which
also drives the outcome. A controller that fits the action effect without adjusting for z
learns the wrong sign and drives the true plant away from target; adjusting for z recovers the
effect and control succeeds. This is the "causal != predictive for control" figure:
plan with the learned effect, act on the true system — the model/plant split of chc.mpc.
certainty_equivalent_control(a, b_hat, x, x_target, u_lo, u_hi)
¶
One-step control to reach x_target under the believed dynamics x' = a x + b_hat u.
closed_loop(system, b_hat, x0, x_target, n_steps, u_lo, u_hi, key)
¶
Roll the TRUE plant under the certainty-equivalent controller that believes b_hat.
run_flagship(*, n_data=20000, x0=0.0, x_target=2.0, n_steps=30, u_lo=-10.0, u_hi=10.0, seed_data=0, seed_run=1, estimator=None)
¶
Estimate the effect two ways from confounded logs, then control the true plant with each.
estimator is the pluggable causal backend for the adjusted (causal) effect; the naive effect
is always the fixed unadjusted fit. Default BackdoorOLS reproduces the linear adjustment.