API reference¶
One page per public class and function, generated from docstrings via
sphinx.ext.autosummary. Each ## section below is a real import
path (metacausal, metacausal.aggregation, …); each item is
listed once, under the module it’s defined in.
Many aggregation-strategy and adapter classes (e.g. Median,
CausalMLAdapter) are re-exported at the top level for convenience –
from metacausal import Median works even though it’s documented
under metacausal.aggregation below. See the Mixed-framework method
list or metacausal.__all__
for the exact top-level surface.
metacausal¶
Top-level namespace: the ensemble class, its estimate/result types, and outcome-type detection.
Ensemble of causal estimators with robust aggregation. |
|
Result from the ensemble of causal estimators. |
|
Ensemble CATE result. |
|
Result from a single causal estimator. |
|
CATE result from a single component method. |
|
Detect the outcome type from the values of |
Warnings¶
Umbrella class for all metacausal-emitted warnings. |
|
Base class for warnings indicating an operating-ensemble pool reduction. |
|
A component raised an exception during fit, cross-fitting, prediction, or as part of nuisance/weight-fitting machinery, and was silently excluded from the operating ensemble. |
|
A component was excluded by configuration mismatch. |
|
A bootstrap inference call hit a reliability concern. |
metacausal.aggregation¶
Aggregation strategies (combine component ATE/CATE predictions into an ensemble estimate) and the result types they produce.
Abstract base class for all aggregation strategies. |
|
Base class for strategies that apply a fixed statistical rule pointwise. |
|
Base class for strategies that select/weight models by inter-model agreement. |
|
Base class for outcome-supervised aggregation strategies. |
|
Pointwise mean aggregation. |
|
Pointwise median aggregation. |
|
Pointwise trimmed-mean aggregation. |
|
Consensus Based Averaging (Machluf et al., 2024). |
|
Causal Stacking (Han & Wu, 2022). |
|
Doubly Robust Q-Aggregation (Lan & Syrgkanis, 2024). |
|
R-Stacking (Nie & Wager, 2021). |
|
Select the single component model minimizing a pseudo-outcome risk. |
|
Result of weight computation for any non-pointwise aggregation. |
|
Bootstrap inference results for both ATE and CATE. |
Cross-fitting¶
Q-fold cross-fitting split. |
|
Simple train / averaging-set split. |
|
Result of a data split: absolute indices into the original array per fold. |
Nuisance estimation¶
Out-of-fold nuisance model predictions. |
|
Fit nuisance models via cross-fitting and return out-of-fold predictions. |
|
Compute the DR/AIPW pseudo-outcome for each observation. |
|
Compute Robinson decomposition residuals. |
metacausal.adapters¶
Wrappers presenting each supported library’s estimators (EconML, CausalML, DoubleML, stochtree) through one common interface, plus generic adapters for wrapping arbitrary user-supplied estimators.
Protocol that all causal estimator adapters must satisfy. |
|
Wrap an initialized-but-unfitted EconML estimator. |
|
Wrap a CausalML estimator as a metacausal causal estimator. |
|
Wrap a DoubleML estimator class for use in CausalEnsemble. |
|
Wrap stochtree's BCFModel for use in CausalEnsemble. |
|
Wrap a callable |
|
Wrap callables as a CATE-capable causal estimator. |
|
Sentinel env var set inside every MetaCausal parallel worker. |
metacausal.plots¶
Requires the plots extra (pip install "metacausal[plots]"). Each
function is also available as a thin method on the class it plots –
see the corresponding class above (e.g. BootstrapResult.forest()).
Forest plot of per-component and ensemble ATEs. |
|
Bar chart of aggregation weights. |
|
Ensemble CATE along one covariate, with optional bootstrap CI. |
|
Pairwise disagreement between component CATEs evaluated on |
metacausal.datasets¶
Load the Lalonde job training dataset. |