uber/causalml

Uplift modeling and causal inference with machine learning algorithms

🚀 What is CausalML?

CausalML is an open‑source Python library from Uber that bundles a collection of uplift‑modeling and causal‑inference algorithms. In plain language, it lets you ask the question “What would happen to a specific user if we showed them a particular ad / treatment?” and get a data‑driven estimate of that individual‑level effect (the Conditional Average Treatment Effect, or CATE).


🎯 Core Use‑Cases

Scenario Why CausalML helps
Campaign targeting Identify the subset of customers who will respond positively to an ad, maximizing ROI from A/B tests or historic logs.
Personalized engagement Estimate heterogeneous effects for multiple product or messaging options, enabling per‑user recommendation of the best treatment.

🛠️ What the library actually provides

Feature What you get
Standardised API All estimators share a common interface (fit, predict, predict_ite, etc.) so you can swap methods without rewriting code.
Broad algorithm palette Tree‑based uplift models, meta‑learners (T‑learner, S‑learner, X‑learner, DR‑learner, R‑learner), doubly‑robust methods, and neural‑network based approaches.
Benchmark datasets Built‑in loaders for classic causal inference data (LaLonde, IHDP, Twins) with SHA‑256 verified downloads and ready‑made metrics (PEHE, ATE error, policy risk).
Leader‑board notebook A reproducible notebook that re‑creates published benchmark numbers, useful for sanity‑checking new ideas.
Extensive docs & tutorials Step‑by‑step quick‑starts, a full estimator‑selection guide, and FAQ to get you from installation to production.

📦 Getting started (in a nutshell)

pip install causalml          # from PyPI
from causalml.inference.tree import UpliftTreeClassifier
model = UpliftTreeClassifier()
model.fit(X, treatment, y)          # X = features, treatment = 0/1, y = outcome
ite = model.predict_ite(X_test)    # individual treatment effect estimates

The docs (quickstart, tutorials, notebooks) walk through exactly this flow and show how to evaluate the model on the built‑in benchmark suites.


📚 Where to learn more

  • Tutorial – Estimating and Validating Heterogeneous Treatment Effects (end‑to‑end walkthrough).
  • Choosing an Estimator – decision tree that matches data size, treatment type, and performance needs.
  • Benchmark Datasets & Leaderboard – reproducible performance numbers on standard causal benchmarks.

🤝 Community & Governance

  • Apache 2.0 license – free for commercial and academic use.
  • Uber maintains the core, but contributions are welcomed (see CONTRIBUTING.md).
  • The project is “stable” but still incubating; APIs may evolve as new research is incorporated.

📖 TL;DR

CausalML is a production‑ready Python toolbox for estimating how individuals respond to interventions. It wraps a wide range of modern causal‑inference methods behind a unified API, ships ready‑made benchmark data, and provides thorough documentation—making it a go‑to library for anyone who wants to move from simple A/B testing to true personalized decision‑making.

Related

  • Project
  • Project
  • Project
  • Project
  • Project