Skip to main content

Causal Bootstrapping utility package

Project description

Causal Assistant

This library is a semi-wrapper around Jianqiao Mao's causalBootstrapping package (based upon Little et al.'s Causal Bootstrapping paper) to improve the user-friendliness and performance of the technique when used for general causal de-confounding.

Causal Bootstrapping is a process for improving model robustness in the presence of causal factors (confounders) by iteratively re-weighting samples within a dataset.

(image: demonstration of causal bootstrapping on synthetic data)

For reference on causality, I suggest reading the works of Judea Pearl. To my knowledge, neither of his books on the topic (Causality, The Book of Why) are freely available outside of academia, however Probabilistic and Causal Inference is, and may be a good place to get started.

Usage and Development

  • The project has been built with an assumed Python version of 3.12, however earlier and later versions may also work.
  • I recommend uv and virtual environments for dependency management.
  • Pull requests are welcome for new functionality or fixes!

Basic Usage:

import causal_assistant as ca

# load your feature data
X, y, u = ...

# de-confound the data!
X_dc, y_dc = ca.bootstrap(causal_graph="""X;y;u;X->y;u->X;u->y;""", X=X, y=y, u=u)

Attribution

Some code in this module is derived from the causalBootstrapping library.

If you use this library, please also cite the originating paper:

@article{little2019causal,
  title={Causal bootstrapping},
  author={Little, Max A and Badawy, Reham},
  journal={arXiv preprint arXiv:1910.09648},
  year={2019}
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

causal_assistant-0.3.0.tar.gz (220.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

causal_assistant-0.3.0-py3-none-any.whl (22.1 kB view details)

Uploaded Python 3

File details

Details for the file causal_assistant-0.3.0.tar.gz.

File metadata

  • Download URL: causal_assistant-0.3.0.tar.gz
  • Upload date:
  • Size: 220.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for causal_assistant-0.3.0.tar.gz
Algorithm Hash digest
SHA256 be025fb826a47253d539c08b46b49581478aedb61274ef22b4d12f5a81ef4739
MD5 fed8765074a337d87d35734dafcd165a
BLAKE2b-256 d5a142799d088b963e69092a57de11b68b17ed6effbe5c35e662d19aab02147e

See more details on using hashes here.

File details

Details for the file causal_assistant-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for causal_assistant-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 74475bf601bc7cb4622fa18988d81e22caa39b3ff20e2f8c6a252f819ec07241
MD5 aa7a5cc4cdd8eb6b1bc65615c8e68fbf
BLAKE2b-256 39dc9432013cd93971f62b13ecef52c9790cb1920cc2d0bf2f5816a23f3c43b2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page