Skip to main content
Pre-release

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

CausalScience

CausalScience is a functional distribution of the CausalEngine library from source commit 4bdf0bc38445b31a50cd384f7cbf766af23b2a23.

Install with python -m pip install CausalScience and import with import causalscience. For example: from causalscience import CSCM, estimate_uca. This alpha release is version 0.1.0a13 and requires Python 3.11 or later.

The upstream CausalEngine repository and license notices retain their original names. Upstream documentation may use causalengine; use causalscience as the import and module-command prefix for this distribution.

CausalEngine is a Python library for structural causal model (SCM) simulation, graph-based identification, and causal-effect estimation. It is an alpha research package (0.1.0a13). Public imports use causalscience; all runtime source is in src/causalscience/.

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

Use Python 3.11 or later in your project environment:

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

Optional source-checkout installation requires access to the upstream repository; from this distribution's source archive or prepared checkout, use python -m pip install ..

The installed demo runs from any directory. For source development, use python -m pip install --no-deps --no-build-isolation -e . once the declared dependencies are installed. See installation for virtual environments, reproducible older pins and wheel delivery.

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.

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

After installing this distribution, run its adapted public API checks with python -B -m unittest discover -s tests -p test_public_api.py -v from the source archive root. Other upstream tests and tutorials retain their original namespace and need namespace adaptation before running against this distribution. Old flat imports such as import SCM are retired; 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.0a13

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.0a13
File Size Uploaded Provenance Actions
causalscience-0.1.0a13.tar.gz 295.3 kB Without provenance Details for causalscience-0.1.0a13.tar.gz

Built distribution (wheel)

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

Total release size: 512.9 kB

Release files / causalscience-0.1.0a13.tar.gz

Download URL causalscience-0.1.0a13.tar.gz
Size 295.3 kB
Tags Source
SHA-256 checksum
How to use checksums
899de4b43e609b4741cabef748589b3f7d6f5136c590386733102a7e92a8d6a5
BLAKE2b-256 checksum
How to use checksums
0dca6c816f22f6992663cdf44361250d7eaf8393337723f6b66edb11e17832ec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

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

Download URL causalscience-0.1.0a13-py3-none-any.whl
Size 217.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7cf7e0a952e3b2ebaec40ec2412aad17145f8429e1941acaf2310ac969e43c17
BLAKE2b-256 checksum
How to use checksums
a61e604b071c27aea04def64d16bcfb8c4495f686a060ce45524b3d25a2e555a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for CausalScience 0.1.0a13

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