API reference

One page per public class and function, generated from docstrings via sphinx.ext.autosummary. Each ## section below is a real import path (xcausal, xcausal.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 xcausal import Median works even though it’s documented under xcausal.aggregation below. See the Mixed-framework method list or xcausal.__all__ for the exact top-level surface.

xcausal

Top-level namespace: the ensemble class, its estimate/result types, and outcome-type detection.

xcausal.CausalEnsemble

Ensemble of causal estimators with robust aggregation.

xcausal.AteEstimate

Result from the ensemble of causal estimators.

xcausal.CateEstimate

Ensemble CATE result.

xcausal.ComponentAteEstimate

Result from a single causal estimator.

xcausal.ComponentCateEstimate

CATE result from a single component method.

xcausal.infer_outcome_type

Detect the outcome type from the values of Y.

Warnings

xcausal.XCausalWarning

Umbrella class for all xcausal-emitted warnings.

xcausal.ComponentWarning

Base class for warnings indicating an operating-ensemble pool reduction.

xcausal.ComponentFailureWarning

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.

xcausal.ComponentExclusionWarning

A component was excluded by configuration mismatch.

xcausal.BootstrapWarning

A bootstrap inference call hit a reliability concern.

xcausal.RiskDifferenceWarning

A binary-outcome ensemble point estimate is outside [-1, 1].

xcausal.defaults

Factories for the shipped component pools and their outcome/propensity models. See Default components and model configuration for generated rosters, resolved settings, and independent member effect-model examples. Supervised aggregation’s nuisance arguments configure its weight-learning loss; member models are configured through CausalEnsemble(methods=[...]).

xcausal.defaults.default_methods

Return a default set of causal estimators for the given outcome type.

xcausal.defaults.default_outcome_model

Default outcome model for the given outcome type.

xcausal.defaults.default_propensity_model

Default propensity model: HistGradientBoostingClassifier.

xcausal.aggregation

Aggregation strategies (combine component ATE/CATE predictions into an ensemble estimate) and the result types they produce.

xcausal.aggregation.AggregationStrategy

Abstract base class for all aggregation strategies.

xcausal.aggregation.PointwiseStrategy

Base class for strategies that apply a fixed statistical rule pointwise.

xcausal.aggregation.AgreementStrategy

Base class for strategies that select/weight models by inter-model agreement.

xcausal.aggregation.SupervisedStrategy

Base class for outcome-supervised aggregation strategies.

xcausal.aggregation.Mean

Pointwise mean aggregation.

xcausal.aggregation.Median

Pointwise median aggregation.

xcausal.aggregation.TrimmedMean

Pointwise trimmed-mean aggregation.

xcausal.aggregation.CBA

Consensus Based Averaging (Machluf et al., 2024).

xcausal.aggregation.CausalStacking

Causal Stacking (Han & Wu, 2022).

xcausal.aggregation.QAggregation

Doubly Robust Q-Aggregation (Lan & Syrgkanis, 2024).

xcausal.aggregation.RStacking

R-Stacking (Nie & Wager, 2021).

xcausal.aggregation.Select

Select the single component model minimizing a pseudo-outcome risk.

xcausal.aggregation.EnsembleWeights

Result of weight computation for any non-pointwise aggregation.

xcausal.aggregation.BootstrapResult

Bootstrap inference results for both ATE and CATE.

Cross-fitting

xcausal.aggregation.CrossFitSplit

Q-fold cross-fitting split.

xcausal.aggregation.TrainAvgSplit

Simple train / averaging-set split.

xcausal.aggregation.FoldSpec

Result of a data split: absolute indices into the original array per fold.

Nuisance estimation

xcausal.aggregation.NuisanceEstimates

Out-of-fold nuisance model predictions.

xcausal.aggregation.fit_nuisance

Fit nuisance models via cross-fitting and return out-of-fold predictions.

xcausal.aggregation.dr_pseudo_outcome

Compute the DR/AIPW pseudo-outcome for each observation.

xcausal.aggregation.robinson_residuals

Compute Robinson decomposition residuals.

xcausal.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.

xcausal.adapters.CausalEstimator

Protocol that all causal estimator adapters must satisfy.

xcausal.adapters.EconMLAdapter

Wrap an initialized-but-unfitted EconML estimator.

xcausal.adapters.CausalMLAdapter

Wrap a CausalML estimator as a xcausal causal estimator.

xcausal.adapters.DoubleMLAdapter

Wrap a DoubleML estimator class for use in CausalEnsemble.

xcausal.adapters.StochtreeAdapter

Wrap stochtree's BCFModel for use in CausalEnsemble.

xcausal.adapters.GenericATEAdapter

Wrap a callable fn(X, T, Y) -> float as an ATE-only causal estimator.

xcausal.adapters.GenericCATEAdapter

Wrap callables as a CATE-capable causal estimator.

xcausal.adapters.INNER_WORKER_ENV

Sentinel env var set inside every XCausal parallel worker.

xcausal.plots

Requires the plots extra (pip install "xcausal[plots]"). Each function is also available as a thin method on the class it plots – see the corresponding class above (e.g. BootstrapResult.forest()).

xcausal.plots.forest

Forest plot of per-component and ensemble ATEs.

xcausal.plots.weights

Bar chart of aggregation weights.

xcausal.plots.cate_profile

Ensemble CATE along one covariate, with optional bootstrap CI.

xcausal.plots.disagreement

Pairwise disagreement between component CATEs evaluated on X.

xcausal.datasets

xcausal.datasets.load_lalonde

Load the Lalonde job training dataset.