Skip to main content

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}
}

Metadata

Release files for causal-assistant 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for causal-assistant 0.3.0
File Size Uploaded
causal_assistant-0.3.0.tar.gz 220.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for causal-assistant 0.3.0
File Interpreter ABI Platform
causal_assistant-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 242.6 kB

Release files / causal_assistant-0.3.0.tar.gz

Download URL causal_assistant-0.3.0.tar.gz
Size 220.5 kB
Tags Source
SHA-256 checksum
How to use checksums
be025fb826a47253d539c08b46b49581478aedb61274ef22b4d12f5a81ef4739
BLAKE2b-256 checksum
How to use checksums
d5a142799d088b963e69092a57de11b68b17ed6effbe5c35e662d19aab02147e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.9

Release files / causal_assistant-0.3.0-py3-none-any.whl

Download URL causal_assistant-0.3.0-py3-none-any.whl
Size 22.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
74475bf601bc7cb4622fa18988d81e22caa39b3ff20e2f8c6a252f819ec07241
BLAKE2b-256 checksum
How to use checksums
39dc9432013cd93971f62b13ecef52c9790cb1920cc2d0bf2f5816a23f3c43b2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.9

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files

0.2.0

2 release files

0.1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page