Skip to content
StatsOtter A workspace for causal thinking
Method library WORKFLOW / 034
Research workflow/4 steps

Uplift modelling with S-, T-, X- and R-learners (CausalML)

Source CausalML — Uber (Chen, Harinen, Lee, Zhao et al.)
01
The method workspace

Follow the analysis.

Select a node to explore the method

Method mapInput → 4 steps → output
START WITHInput data
ARRIVE ATResults
Read step 01
Inside the methodReasoning, equations & implementation
Step 1 of 4
01
Data prep

Outcome, treatment, features

Data preparation — shapes the raw inputs into what the estimator expects.

What happens here

Assemble Y, the treatment flag W, and features X. The estimand is the conditional uplift τ(x).

Formula
\tau(x)=\mathbb{E}[\,Y(1)-Y(0)\mid X{=}x\,]
Reads fromNot specified Feeds intoNot specified
Key code
# y outcome, w treatment (0/1), X features

Reference / docs ↗

Discussion on this step (0)
StatsOtterDiscussion starter · Editorial note

Before using this step, make its assumptions and its output explicit. A useful peer note explains what you would check, what could go wrong, or what would change your interpretation.

Questions to explore
  1. Which assumption matters most here, and what evidence could challenge it?
  2. What would you check before passing this output to the next step?

Peer discussion

  • Bring your experience, a question, or a different perspective.
02
Data contract

Inputs & data

An outcome Y, a binary treatment W, and features X — typically from an experiment or a de-confounded observational sample.

Show data format & exampleHide example

Format — one row per unit: outcome y, treatment flag w, features X.

from causalml.inference.meta import BaseXRegressor
from xgboost import XGBRegressor
learner = BaseXRegressor(XGBRegressor())
cate = learner.fit_predict(X, treatment=w, y=y)
03
Read the evidence

Results & interpretation

2 figures Workflow discussion 2
01FigureCausalML benchmarks the S-, T-, X- and R-learners: CATE error (MSE) vs. ATE error, train vs. validation — pick the learner that generalises.
02FigureUplift gain curve: targeting by the model captures far more cumulative effect than random allocation across the population.

Figures reproduced from CausalML — Uber (Chen, Harinen, Lee, Zhao et al.) — unofficial community showcase; all credit to the original authors.

Context & interpretation

⚠️ Unofficial community showcase of causalml. Not affiliated with the authors; all credit to them.

Estimate who responds, not just the average: fit a family of meta-learners for the CATE, pick the best by validation error, then rank and target with an uplift curve.

Peer notes

Discuss the workflow (2)

  • 2

    The 'no single best meta-learner, score on validation' framing is right. I've watched the X-learner win and lose on the same product.

  • 1

    The uplift gain curve over random is the plot that actually convinces ops. Saved.

IN THE MARGINS

Peer discussion