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.2.0.tar.gz (219.9 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.2.0-py3-none-any.whl (21.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: causal_assistant-0.2.0.tar.gz
  • Upload date:
  • Size: 219.9 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.2.0.tar.gz
Algorithm Hash digest
SHA256 a8d51a27d8d7ce43e37a0f1526dfce9dc36fb17c78a035c04b7aac3437897b61
MD5 283fbae67f8687f1c9867233550efad2
BLAKE2b-256 3f080229f1b3df4fd628a8f098a8af33e60b47b09f0bd1a4353ee593d00b152c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for causal_assistant-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8ceb147039c6ba97ff0adc8999a8038e4593a451068cf324e056e13e4cd23137
MD5 e394d0eb52594bcaa78a0295814bcea5
BLAKE2b-256 43a93410e5533faf6885b16e000d346b5f15871020ec1338886c7127f41b499c

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