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.1.1.tar.gz (203.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.1.1-py3-none-any.whl (20.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: causal_assistant-0.1.1.tar.gz
  • Upload date:
  • Size: 203.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.1.1.tar.gz
Algorithm Hash digest
SHA256 e518b44908f180f6e4e6c246f25d61278b39cd410b0932afcf69e13bb320cc28
MD5 a2cbb71f14235526dfaad1aac73db06c
BLAKE2b-256 79fd6c73953aa5592854235a736b24e78afec41bff413e07f4589f9f82f10937

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for causal_assistant-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d438c287dd8747a9f81df32b2f71f89f8d0c92b2d8eb827bd4fc0f3f2a80556e
MD5 d1bc16ef93346cdd041fb71038d06bcb
BLAKE2b-256 a6044e01dc116defb66b45de0a827da5ec5d41a112965b114264b36a955438f6

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