EconML is a Python library for estimating Conditional Average Treatment Effects (CATEs) from observational or experimental data. It provides a suite of advanced machine learning methods, including Double Machine Learning (DML) and Causal Forests, to infer causal relationships and individual-level treatment effects. The current version is 0.16.0, and it maintains an active development pace with major updates and bugfix releases every few months.
pip install econmlVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to use `CausalForestDML` to estimate Conditional Average Treatment Effects (CATEs) using synthetic data. It involves defining confounders (W), features for heterogeneity (X), treatment (T), and outcome (Y), then fitting the model and predicting CATEs for new feature values. `RandomForestRegressor` and `RandomForestClassifier` are used as base learners for Y and T models respectively.
Update import statements from `from econml.dml import DynamicDML` to `from econml.panel import DynamicDML`.
Explicitly set the `alpha` parameter in `effect_interval` or similar methods if you rely on a specific alpha value or wish to restore prior behavior.
Ensure your installed `shap` version is within the compatible range. Downgrade `shap` to `<0.44.0` if you encounter issues (`pip install 'shap<0.44.0'`).
Install `econml` with the `[deepiv]` extra (`pip install econml[deepiv]`) to ensure the correct `tensorflow`/`keras` versions are pulled, or manually manage these dependencies carefully to avoid conflicts with other parts of your environment.
Install `econml` with the `[ray]` extra (`pip install econml[ray]`) to enable distributed training capabilities.