Git Product home page Git Product logo

auto-causality's Introduction

c# Auto-Causality: A library for automated Causal Inference model estimation and selection

AutoCausality is a library for automated Causal Inference, building on the FLAML package for hyperparameter optimisation and the EconML and DoWhy packages for ML-based Causal Inference. It performs automated hyperparameter tuning of first stage models (for the treatment and outcome models) as well as hyperparameter tuning and model selection for the second stage model (causal estimator).

For now, the package only supports CATE models, instrumental variable models are coming next!

Table of Contents

Installation

To install from source, see For Developers section below. TODO: make available as package on pypi

Requirements AutoCausality requires the following libraries to work:

  • NumPy
  • Pandas
  • EconML
  • DoWhy
  • Scikit-Learn

If you run into any problems, try installing the dependencies manually:

pip install -r requirements.txt

Quick Start

The autocausality package can be used like a scikit-style estimator:

from auto_causality import AutoCausality
from auto_causality.datasets import synth_ihdp
from auto_causality.data_utils import preprocess_dataset

# prepare dataset
data_df = synth_ihdp()
treatment = 'treatment'
targets=['y_factual']
data_df, features_X, features_W = preprocess_dataset(data_df, treatment, targets)

# init autocausality object with chosen metric to optimise
ac = AutoCausality(time_budget=10, metric='erupt')

# run autocausality
myresults = ac.fit(data_df, treatment, targets[0],
                   features_W, features_X)

# return best estimator
print(f"Best estimator: {ac.best_estimator}")

Supported Models

The package supports the following causal models:

  • Meta Learners:
    • S-Learner
    • T-Learner
    • X-Learner
    • Domain Adaptation Learner
  • DR Learners:
    • Forest DR Learner
    • Linear DR Learner
    • Sparse Linear DR Learner
  • DML Learners:
    • Linear DML
    • Sparse Linear DML
    • Causal Forest DML
  • Ortho Forests:
    • DR Ortho Forest
    • DML Ortho Forest

Supported Metrics

We support a variety of different metrics that quantify the performance of a causal model:

  • ERUPT (Expected Response Under Proposed Treatments)
  • Qini coefficient
  • AUC (area under curve)
  • R-Scorer
  • ATE (average treatment effect)

Citation

If you use AutoCausality in your research, please cite us as follows: Timo Flesch, Edward Zhang, Guy Durant, Wen Hao Kho, Mark Harley, Egor Kraev. Auto-Causality: A Python package for Automated Causal Inference model estimation and selection. https://github.com/transferwise/auto-causality. 2022. Version 0.x You can use the following BibTex entry:

@misc{autocausality,
  author={Timo Flesch, Edward Zhang, Guy Durant, Wen Hao Kho, Mark Harley, Egor Kraev},
  title={{Auto-Causality}: {A Python package for Automated Causal Inference model estimation and selection}},
  howpublished={https://github.com/transferwise/auto-causality},
  note={Version 0.x},
  year={2022}
}

For Developers

Installation from source

We use Setuptools for building and distributing our package. To install the latest version from source, clone this repository and run the following command from the top-most folder of the repository

pip install -e .

Testing

We use PyTest for testing. If you want to contribute code, make sure that the tests in tests/autocausality/test_endtoend.py run without errors.

auto-causality's People

Contributors

dependabot[bot] avatar ed-zh avatar egorkraevtransferwise avatar guydurant avatar markharley avatar timoflesch avatar wforgodot 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.