timmens / causal-forest

Implements the Causal Forest algorithm formulated in Athey and Wager (2018).
MIT License
65 stars 12 forks source link
causal-inference econometrics machine-learning

causal-forest

Contributors MIT License Coverage Build Status Documentation Status Black Code Style

Word of warning

The package is still in development stage and should not be used other than for experimental reasons. With version 0.1.0 we will benchmark our code against existing code.

Introduction

The cforest package can be used to estimate heterogeneous treatment effects in a Neyman-Rubin potential outcome framework. It implements the Causal Forest algorithm first formulated in Athey and Wager (2018).

Install

The package can be installed via conda. To do so, type the following commands in a terminal:

conda install -c timmens cforest

Documentation

The documentation is hosted at https://causal-forest.readthedocs.io/en/latest/.

Example

Complete example:

For a complete working example going through all main features please view our example notebook. <a href="https://nbviewer.jupyter.org/github/timmens/causal-forest/blob/master/docs/source/getting_started/example.ipynb" target="_parent"> <img align="center" src="https://raw.githubusercontent.com/jupyter/design/master/logos/Badges/nbviewer_badge.png" width="109" height="20">

Minimal example:

from cforest.forest import CausalForest

X, t, y = simulate_data()

cf = CausalForest()

cf = cf.fit(X, t, y)

XX = simulate_new_features()
predictions = cf.predict(XX)

References