Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

CausalScience

CausalScience provides structural causal model (SCM) simulation, graph-based identification and causal-effect estimation. This source prepares the 0.1.0a14 release candidate with 22 public exports, including estimate_capo and CSCM_capo Simpson support. Both source and installed imports use causalscience; runtime files are under src/causalscience/.

The GitHub repository and local checkout directory are named CausalScience. Historical snapshots and the CausalEngine Noncommercial License retain their original names.

Choose your task

What you have or need Start here
Observed data and an assumed back-door/front-door/sequential formula Graph-free estimators: estimate_bd, estimate_sbd, estimate_fd, estimate_uca
A causal graph and observed data Identify and estimate: identify_query, fit_query_mean
Simulated tasks and conditional average potential outcome (CAPO) targets Generators and truth: BDSCM, CSCM, CSCM_capo
Average treatment effect (ATE) or conditional average treatment effect (CATE) Paired effects: estimate_ate, estimate_cate
Learn conditional outcome means for each treatment arm CAPO prediction: a14 candidate estimate_capo
Code to change Implementation map or Wiki

A graph-free estimator executes your chosen identifying formula. It does not infer or verify a causal graph from the data.

Install

Python 3.11+ is required. To install or update the latest published release:

python -m pip install --upgrade causalscience
python -m causalscience.demo

Check python -c "import causalscience; print(causalscience.__version__)" before using version-specific features. Public a13 does not contain the new CAPO API or CSCM_capo Simpson extension. For the a14 candidate, install its reviewed wheel or this checkout in a project environment:

python -m pip install /path/to/causalscience-0.1.0a14-py3-none-any.whl
# Alternatively, from this source checkout:
python -m pip install .

Both routes use import causalscience. See installation for environment setup and editable development. Candidate preparation does not itself publish a release to PyPI.

One complete example

This binary synthetic example estimates the mean under action A=1. It is not an ATE; the adjustment assumption is supplied by the caller.

import numpy as np
import pandas as pd
from causalscience import estimate_bd

rng = np.random.default_rng(11)
c = rng.binomial(1, .5, 1200)
a = rng.binomial(1, .2 + .5*c)
y = rng.binomial(1, .1 + .3*c + .4*a)
data = pd.DataFrame(dict(C=c, A=a, Y=y))
fit = estimate_bd(data, treatment="A", outcome="Y", adjustment=["C"],
    action=1, schema={name: "binary" for name in data}, num_boost_round=30)
assert fit["estimation_status"] == "ACCEPT"
assert fit["graph_verification"] == "not_run"
assert fit["causal_interval"] is None
print(fit["estimate"])

Defaults use Unified Covariate Adjustment (UCA) full scores with XGBoost backward regressions and separate normalized minimum-L2 weights. Graph-based default fitting checks the Fixed-partition Multilinearity Criterion (FMC), then the Multilinearity Criterion (MC) if needed; graph-free fitting uses the supplied functional. Always inspect status and diagnostics. Successful fitting does not verify overlap, causal assumptions, population consistency or causal confidence-interval coverage.

CAPO estimator in the a14 candidate

estimate_capo learns one treatment regime's conditional expected outcome. Call it for actions 0 and 1 to obtain separate CAPO predictors. This API requires the a14 candidate or later and from causalscience import estimate_capo; it is not included in public 0.1.0a13. See the complete source example and target definitions. The existing public six-API tutorial retains its original scope.

Read more

Browser editions: Document, Wiki, Tutorial.

Repository layout

Directory Responsibility
src/causalscience/ Single canonical runtime: public APIs, SCMs, criteria, score engine and HTML tool
tests/ / tests/checkout/ Installed contracts / source and developer-tool regressions
tutorials/ Maintained walkthrough, demos, benchmarks and named SCM examples; notebooks are labeled historical
docs/ User guide, Wiki, assumptions, benchmarks and provenance
experimental/backdoor_scm/ Separate research component, outside the public distribution
archived/ Preserved historical material

Source developers install the checkout with python -m pip install ., or python -m pip install --no-deps --no-build-isolation -e . after dependencies are installed. Source and installed packages use import causalscience and python -m causalscience.demo. Source checks use PYTHONPATH=src python -B -m unittest discover -s tests/checkout -v. Old causalengine.* and flat imports such as import SCM are not aliases; use causalscience.* imports. The compatibility notes cover external research scripts and frozen snapshots.

Boundaries and license

Default full-score execution supports declared discrete actions; continuous fixed-point actions and unsupported compiler/design cases are declined. CATE requires a supported baseline anchor and learning assumptions; it returns predictions, not automatic pointwise causal intervals. CSCM_capo has fast direct truth lookup but conditional centering can make mixed-X generation expensive. See limitations.

LICENSE is the CausalEngine Noncommercial License 1.0. LICENSING.md preserves prior MIT grants and separate rights. Engine provenance records current canonical hashes and earlier snapshots.

Metadata

Release files for CausalScience 0.1.0a14

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

Source distribution (sdist)

Source distribution for CausalScience 0.1.0a14
File Size Uploaded Provenance Actions
causalscience-0.1.0a14.tar.gz 300.3 kB Without provenance Details for causalscience-0.1.0a14.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for CausalScience 0.1.0a14
File Interpreter ABI Platform Actions
causalscience-0.1.0a14-py3-none-any.whl Python 3 none any Details for causalscience-0.1.0a14-py3-none-any.whl

Total release size: 518.8 kB

Release files / causalscience-0.1.0a14.tar.gz

Download URL causalscience-0.1.0a14.tar.gz
Size 300.3 kB
Tags Source
SHA-256 checksum
How to use checksums
d5cea419eaa740cfc0dec8ed4283b288b3c74ba18ed3d470c12ae60d81bcc843
BLAKE2b-256 checksum
How to use checksums
092881a1a4d3313fb3d41432d5f0a2ec6ca524f765e7e91578c11a13da3f5394
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / causalscience-0.1.0a14-py3-none-any.whl

Download URL causalscience-0.1.0a14-py3-none-any.whl
Size 218.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
543883ed95d138ef79898a3a94a4c1c1acc211dea08bd8613bb86f2b1dad45fd
BLAKE2b-256 checksum
How to use checksums
71fae362c3eb7334cff57e55e782bcfdc185bec9f82faf32786db84bc43a3ab5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Security for CausalScience 0.1.0a14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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