graph LR X["X: covariates"] --> F["fit(X, t, y)"] T["t: treatment"] --> F Y["y: outcome"] --> F F --> P["predict(requested treatments)"]
2 Getting Started
skcausal is easiest to understand if you keep one mental model in mind: every estimator is built around observed covariates X, treatment assignments t, and outcomes y.
2.1 Install The Package
pip install skcausalIf you also want the plotting helpers introduced in the docs examples, install the plotting extra:
pip install "skcausal[plotting]"2.2 The Core Data Contract
The package expects three aligned tables with the same number of rows.
In the documentation examples, those tables are typically polars.DataFrame objects. The important part is not the library choice, but the semantics:
Xcontains pre-treatment covariates.tcontains the intervention variable you want to reason about.ycontains the observed outcome.
2.3 Minimal Dataset Example
from skcausal.datasets import SimpleLinearDataset
dataset = SimpleLinearDataset(
n=250,
t_types=("continuous",),
n_features=4,
random_state=0,
)
X, t, y = dataset.load()The built-in synthetic datasets are useful because they also expose predict(...), which is separate from the estimator API and gives you the known target quantity for benchmarking.
2.4 Where To Go Next
If you want to understand what estimators are expected to return, continue to Estimator Contract.