skillfed

causalml

Python Package for Uplift Modeling and Causal Inference with Machine Learning Algorithms

causalml v0.17.0 144.8K downloads/30d#11,141 on PyPI5,953
Permissive license Active released

What it is and what it does

Causalml is a Python package for estimating heterogeneous treatment effects and performing causal inference using machine learning. It provides a standard interface to compute the Conditional Average Treatment Effect (CATE)—the causal impact of an intervention on an outcome for individual users—from A/B experiments or observational data, without requiring strong assumptions about model form.

The package implements multiple causal inference methods based on recent research, including metalearners, doubly robust estimation, and tree-based approaches. It's designed for practical applications like campaign targeting (identifying customers most likely to respond to an ad) and personalized engagement (recommending optimal treatments for each customer). With 18 runtime dependencies spanning xgboost, lightgbm, statsmodels, and visualization libraries, it trades installation weight for a comprehensive toolkit.

Use it for:

  • Identify which customers will respond favorably to an advertising campaign by estimating individual-level treatment effects from A/B test data.
  • Recommend personalized product offerings or messaging channels by estimating heterogeneous effects for each customer-treatment combination.
  • Analyze observational data to estimate causal impact when randomized experiments are infeasible or unethical.
  • Build targeting policies that maximize ROI by selecting customers with the highest predicted uplift.
  • Feature selection for uplift modeling to identify which customer attributes drive treatment response variation.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Causalml estimates the causal impact of treatments on outcomes at the individual level using machine learning, providing methods to compute Conditional Average Treatment Effect (CATE) from experimental or observational data.

Yes, if you need to estimate causal effects or uplift at the individual level. The package is actively maintained, has no known vulnerabilities, uses a permissive license, and provides a suite of methods backed by published research. The medium install friction (18 dependencies) is justified by the breadth of algorithms and visualization tools. Not suitable if you need minimal dependencies or are restricted to Python versions below 3.11.

Install

causalml on PyPI

pip

pip install causalml

uv

uv add causalml

poetry

poetry add causalml

Installing causalml

Before you install

Medium install friction due to 18 runtime dependencies including heavy ML libraries (xgboost, lightgbm, statsmodels, shap). Pre-built wheels available for Python 3.11 and 3.12 on macOS, Linux, and Windows. Project is actively maintained with recent releases.

License in practice

Licensed under Apache 2.0 (permissive), allowing commercial use, modification, and distribution with minimal restrictions—suitable for most production and research contexts.

Quickstart

pip install causalml

from causalml.inference.meta import BaseXLearner
from scipy import stats

learner = BaseXLearner()
cate = learner.fit_predict(X, treatment, y)

Requires Python 3.11 or later; graphviz system library needed for tree visualization features.

Verify before relying

  • Whether all 18 runtime dependencies are truly required for basic CATE estimation or if subsets work for specific use cases.
  • Performance characteristics and scalability limits for large observational datasets.
  • Stability of experimental APIs mentioned in the disclaimer and which methods are production-ready.

Package facts

License not declared (permissive)
Python support supports the current Python release (>=3.11)
Install friction medium — platform-specific wheel
Runtime dependencies 18 — forestci, pathos, numpy, scipy, matplotlib, pandas, scikit-learn, statsmodels, seaborn, xgboost, pydotplus, tqdm, shap, dill, lightgbm, packaging, graphviz, black
Maintenance actively maintained — 41 days since the last release
Last repo commit
First released
Downloads 144,829/month — #11,141 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: causalml-0.17.0-cp311-cp311-macosx_11_0_arm64.whl; causalml-0.17.0-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl; causalml-0.17.0-cp311-cp311-win_amd64.whl; causalml-0.17.0-cp312-cp312-macosx_11_0_arm64.whl; causalml-0.17.0-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl; causalml-0.17.0-cp312-cp312-win_amd64.whl

License :: OSI Approved :: Apache Software LicenseOperating System :: OS IndependentProgramming Language :: Python

Tags

uplift modelingcausal inference machine learningheterogeneous treatment effectsconditional average treatment effectpersonalized treatment effect estimationcampaign targeting optimizationobservational data causal analysis
causal-inferencetreatment-effect-estimationuplift-modeling

More Artificial Intelligence packages

Further reading