Giter Club home page Giter Club logo

causal_inference_laboratory's Introduction

Causal Inference

The main goal of this project is to build libraries and models rooted in deep learning to estimate the causal effects of an intervention on some measurable outcomes (e.g. the effect of a treatment or procedure on survival).

Installing dependencies

pip install --upgrade pip
pip install -r requirements.txt

Performing estimation

While in the base directory of the repo, run:

python estimate.py

The results of all estimators will be stored in folder estimation_results.

Available estimators:

  • COM/S-Learner: OLS1, RF1, NN1;
  • GCOM/T-Learner: OLS2, RF2, NN2;
  • Inverse Probability Weighting (IPW);
  • Double Machine Learning/R-Learner;
  • TARNet
  • Dragonnet

where OLS stands for Ordinary Least Squares, RF stands for Random Forest, and NN stands for Nerual Networks. They represent ML models that are linear, ensembled, and non-linear respectively.

Available datasets:

Please see the description of the datasets in the data folder.

  • IHDP-100
  • Jobs
  • TWINS

Available metrics:

  • Mean absolute error (MAE) of ATE
  • Precision in Estimation of Heterogeneous Effect (PEHE)

Performing nusiance model estimation

The nuisance models are the models used in the paper Empirical Analysis of Model Selection for Heterogenous Causal Effect Estimation to estimate the ground truth for PEHE calculation.

While in the base directory of the repo, run:

python utils/nuisance_model_selection.py --dataset <dataset_name>

This uses AutoML to estimate the best model for each nuisance model. The results are stored in the estimation_results/<dataset_name>/models folder. The results for Jobs and TWINS are already stored in the repo.

Available estimators:

  • T-Learner 0
  • T-Learner 1
  • S-Learner
  • Double Machine Learning (DML)
  • Propensity

Available datasets:

  • IHDP-100
  • Jobs
  • TWINS

Performing evaluation

After performing estimation, run:

python evaluate.py

Running Notebooks

  • Open the notebooks folder and click on the desired notebook.
  • At the top of the notebook, click on the Open in Colab button.
  • Follow the instructions in the Colab to run the code.

For the Demo_End2End_Causal_Estimation_Pipeline.ipynb notebook, to ensure that you've initialized it correctly, check the following:

  • After running the first code block in Colab, your file directory should look like this:

image

(Note: you can press image to refresh)

using pre-commit hooks

To check your code at commit time

pre-commit install

You can also get pre-commit to fix your code

pre-commit run

causal_inference_laboratory's People

Contributors

elhamdolatabadi avatar gkysaad avatar kohankhaki avatar wenxu-uoft avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.