causalml
Uplift modeling and causal inference with machine learning algorithms
CausalML is a Python package from Uber that helps answer a specific type of question: not just whether something happened, but whether an action you took actually caused it. This is the problem that causal inference addresses. For example, a company might run an ad campaign and see an increase in purchases, but were those purchases caused by the ad, or would those customers have bought anyway? CausalML provides tools to estimate the difference.
The core idea in the package is uplift modeling, also called heterogeneous treatment effect estimation. Rather than measuring the average effect of a treatment across all users, it tries to estimate the effect for each individual person based on their characteristics. This matters when the same action can have very different effects on different people: some users respond strongly to a promotion, others are unaffected, and some might even react negatively.
Two main use cases are described in the README. One is campaign targeting: instead of showing an ad to everyone, identify which customers will actually change their behavior because of the ad and focus spend on them. The other is personalized engagement: when a company has multiple options for interacting with a customer (different offers, channels, or messages), causal methods can estimate which option will produce the best outcome for each individual.
The package works with data from controlled experiments (like A/B tests) or from historical observational data where no experiment was run. It provides a consistent interface across many different underlying algorithms, so you can swap methods without rewriting your analysis code. The underlying methods come from academic research, and the README includes a list of the relevant papers.
CausalML is released under the Apache 2.0 License. It is described as stable and incubated for long-term support, though parts of it may include experimental code with APIs that could change.