CausalScience 0.1.0a13__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- causalscience-0.1.0a13/LICENSE +39 -0
- causalscience-0.1.0a13/LICENSE-MIT.txt +21 -0
- causalscience-0.1.0a13/LICENSING.md +38 -0
- causalscience-0.1.0a13/MANIFEST.in +21 -0
- causalscience-0.1.0a13/PKG-INFO +169 -0
- causalscience-0.1.0a13/README.md +138 -0
- causalscience-0.1.0a13/docs/estimator-benchmark-results.json +726 -0
- causalscience-0.1.0a13/docs/estimator-benchmark.md +33 -0
- causalscience-0.1.0a13/docs/graphless-estimators.md +281 -0
- causalscience-0.1.0a13/docs/indexed-identification.md +155 -0
- causalscience-0.1.0a13/docs/installation.md +218 -0
- causalscience-0.1.0a13/docs/internal-library.md +632 -0
- causalscience-0.1.0a13/docs/uca-benchmark-results.json +999 -0
- causalscience-0.1.0a13/docs/uca-benchmark.md +115 -0
- causalscience-0.1.0a13/docs/validation-history.md +274 -0
- causalscience-0.1.0a13/docs/wiki/README.md +369 -0
- causalscience-0.1.0a13/pyproject.toml +26 -0
- causalscience-0.1.0a13/setup.cfg +4 -0
- causalscience-0.1.0a13/src/CausalScience.egg-info/PKG-INFO +169 -0
- causalscience-0.1.0a13/src/CausalScience.egg-info/SOURCES.txt +70 -0
- causalscience-0.1.0a13/src/CausalScience.egg-info/dependency_links.txt +1 -0
- causalscience-0.1.0a13/src/CausalScience.egg-info/requires.txt +15 -0
- causalscience-0.1.0a13/src/CausalScience.egg-info/top_level.txt +1 -0
- causalscience-0.1.0a13/src/causalscience/CSCM.py +427 -0
- causalscience-0.1.0a13/src/causalscience/ENGINE_LICENSE.txt +38 -0
- causalscience-0.1.0a13/src/causalscience/ENGINE_SOURCES.json +47 -0
- causalscience-0.1.0a13/src/causalscience/SBD.py +432 -0
- causalscience-0.1.0a13/src/causalscience/SCM.py +644 -0
- causalscience-0.1.0a13/src/causalscience/__init__.py +41 -0
- causalscience-0.1.0a13/src/causalscience/adjustment.py +258 -0
- causalscience-0.1.0a13/src/causalscience/bdscm/NOTICE.txt +28 -0
- causalscience-0.1.0a13/src/causalscience/bdscm/__init__.py +11 -0
- causalscience-0.1.0a13/src/causalscience/bdscm/covariates.py +605 -0
- causalscience-0.1.0a13/src/causalscience/bdscm/data/tabdpt_openml.json +128 -0
- causalscience-0.1.0a13/src/causalscience/bdscm/noise.py +45 -0
- causalscience-0.1.0a13/src/causalscience/bdscm/outcome.py +271 -0
- causalscience-0.1.0a13/src/causalscience/bdscm/scm.py +198 -0
- causalscience-0.1.0a13/src/causalscience/bdscm/treatment.py +204 -0
- causalscience-0.1.0a13/src/causalscience/bdscm/utils.py +76 -0
- causalscience-0.1.0a13/src/causalscience/demo.py +37 -0
- causalscience-0.1.0a13/src/causalscience/effects.py +151 -0
- causalscience-0.1.0a13/src/causalscience/estimators.py +199 -0
- causalscience-0.1.0a13/src/causalscience/examples.py +1051 -0
- causalscience-0.1.0a13/src/causalscience/frontdoor.py +418 -0
- causalscience-0.1.0a13/src/causalscience/graph.py +676 -0
- causalscience-0.1.0a13/src/causalscience/graph_tool.py +207 -0
- causalscience-0.1.0a13/src/causalscience/identification_engine.py +595 -0
- causalscience-0.1.0a13/src/causalscience/identify.py +749 -0
- causalscience-0.1.0a13/src/causalscience/indexed_graph.py +2108 -0
- causalscience-0.1.0a13/src/causalscience/indexed_identification.py +1660 -0
- causalscience-0.1.0a13/src/causalscience/random_generator.py +437 -0
- causalscience-0.1.0a13/src/causalscience/scm_registry.py +192 -0
- causalscience-0.1.0a13/src/causalscience/statmodules.py +449 -0
- causalscience-0.1.0a13/src/causalscience/tian.py +504 -0
- causalscience-0.1.0a13/src/causalscience/uca_compiler.py +580 -0
- causalscience-0.1.0a13/src/causalscience/uca_estimation.py +1019 -0
- causalscience-0.1.0a13/src/causalscience/web/NOTICE.txt +25 -0
- causalscience-0.1.0a13/src/causalscience/web/index.html +239 -0
- causalscience-0.1.0a13/src/causalscience/weighting.py +90 -0
- causalscience-0.1.0a13/tests/data/bdscm_regression.json +278 -0
- causalscience-0.1.0a13/tests/test_bdscm.py +267 -0
- causalscience-0.1.0a13/tests/test_cscm.py +689 -0
- causalscience-0.1.0a13/tests/test_effects.py +126 -0
- causalscience-0.1.0a13/tests/test_graph_tool.py +77 -0
- causalscience-0.1.0a13/tests/test_graphless_estimators.py +231 -0
- causalscience-0.1.0a13/tests/test_public_api.py +186 -0
- causalscience-0.1.0a13/tests/test_uca_benchmark.py +70 -0
- causalscience-0.1.0a13/tests/test_uca_defaults.py +129 -0
- causalscience-0.1.0a13/tests/test_weighting.py +120 -0
- causalscience-0.1.0a13/tutorials/benchmark_estimators.py +124 -0
- causalscience-0.1.0a13/tutorials/benchmark_uca.py +191 -0
- causalscience-0.1.0a13/tutorials/current-workflow.md +123 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
CausalEngine Noncommercial License 1.0
|
|
2
|
+
Copyright (c) 2026 Yonghan Jung.
|
|
3
|
+
|
|
4
|
+
1. Scope. These terms cover only copyrightable material in this CausalEngine
|
|
5
|
+
version that Yonghan Jung is entitled to license (Covered Material). LICENSING.md
|
|
6
|
+
identifies exclusions. Existing valid licenses, including prior MIT grants and
|
|
7
|
+
separately licensed components, remain unchanged. These terms do not claim
|
|
8
|
+
ownership of ideas, algorithms as such, third-party material, or outputs merely
|
|
9
|
+
because the software produced them.
|
|
10
|
+
|
|
11
|
+
2. Noncommercial permission. You may use, run, copy, modify and redistribute
|
|
12
|
+
Covered Material only for Noncommercial Purposes. Retain this license,
|
|
13
|
+
LICENSING.md, copyright and applicable third-party notices; clearly mark modified
|
|
14
|
+
files. Noncommercial redistribution grants recipients only these same permissions
|
|
15
|
+
for Covered Material and does not alter separately applicable licenses.
|
|
16
|
+
|
|
17
|
+
3. Noncommercial Purposes. A purpose is noncommercial only if it is not directed
|
|
18
|
+
toward direct or indirect commercial advantage, commercial business operations,
|
|
19
|
+
or paid products or services. Commercial model training, hosted paid services,
|
|
20
|
+
paid consulting and integration into commercial products are not permitted.
|
|
21
|
+
Nonprofit, educational, government or charitable status, or employee/company
|
|
22
|
+
affiliation, does not exempt an otherwise commercial use.
|
|
23
|
+
|
|
24
|
+
4. Commercial rights reserved. No commercial-use permission is granted.
|
|
25
|
+
Commercial use of Covered Material requires separate prior written authorization
|
|
26
|
+
from Yonghan Jung; permissions required from other rightsholders remain separate.
|
|
27
|
+
All rights not expressly granted are reserved. No patent or trademark license is
|
|
28
|
+
granted.
|
|
29
|
+
|
|
30
|
+
5. Statutory rights. Nothing here limits fair use, fair dealing or other
|
|
31
|
+
nonwaivable statutory rights.
|
|
32
|
+
|
|
33
|
+
6. Termination. Your permissions for Covered Material terminate if you breach
|
|
34
|
+
these terms. This does not terminate valid separate or previously granted
|
|
35
|
+
licenses.
|
|
36
|
+
|
|
37
|
+
7. Disclaimer. Covered Material is provided AS IS, without warranties, including
|
|
38
|
+
merchantability, fitness or noninfringement. To the extent allowed by law, its
|
|
39
|
+
licensor is not liable for claims or damages arising from it or its use.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Yonghan Jung
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# CausalEngine license scope
|
|
2
|
+
|
|
3
|
+
This current offering uses the **CausalEngine Noncommercial License 1.0** in
|
|
4
|
+
LICENSE for copyrightable material that Yonghan Jung is entitled to license.
|
|
5
|
+
Noncommercial use, modification and redistribution are permitted on its terms.
|
|
6
|
+
Selling, paid services, internal commercial business use and commercial model
|
|
7
|
+
training require separate prior written permission. This is source-available
|
|
8
|
+
software with noncommercial restrictions, not an OSI open-source license.
|
|
9
|
+
|
|
10
|
+
## Rights that remain separate
|
|
11
|
+
|
|
12
|
+
- Valid prior MIT grants are not revoked. The original MIT text is retained
|
|
13
|
+
verbatim in LICENSE-MIT.txt, originating from commit d1b0b537 on June 10, 2026.
|
|
14
|
+
Anyone holding material under that grant retains its permissions, including
|
|
15
|
+
commercial use, subject to its terms. Retaining this text is not a new MIT
|
|
16
|
+
grant for the whole current package.
|
|
17
|
+
- The frozen src/causalscience/indexed_graph.py retains its explicit MIT
|
|
18
|
+
header and remains separately MIT-licensed.
|
|
19
|
+
- The frozen uca_compiler.py and uca_estimation.py snapshots originally had no
|
|
20
|
+
confirmed upstream license declaration. On October 26, 2026, Yonghan Jung
|
|
21
|
+
explicitly confirmed his authority to license these bundled snapshots and
|
|
22
|
+
authorized their public distribution under the CausalEngine Noncommercial
|
|
23
|
+
License 1.0 in LICENSE. This present authorization does not assert a historical
|
|
24
|
+
upstream grant or a new MIT grant.
|
|
25
|
+
- On October 26, 2026, Yonghan Jung also explicitly confirmed his authority to
|
|
26
|
+
license the imported TransPFN/BDSCM material and authorized its public
|
|
27
|
+
distribution under the same CausalEngine Noncommercial License 1.0. Its
|
|
28
|
+
original provenance and snapshot hashes remain recorded in the BDSCM notice.
|
|
29
|
+
- Dependencies and other separately licensed material retain their own terms.
|
|
30
|
+
No ownership of another author's contribution is established by this policy.
|
|
31
|
+
|
|
32
|
+
The package and its archives retain these notices for accurate provenance. The
|
|
33
|
+
October 26, 2026 author authorization covers the bundled snapshots identified
|
|
34
|
+
above, subject to the root license and separately preserved grants. This policy
|
|
35
|
+
does not revoke earlier grants or establish exclusive rights over ideas,
|
|
36
|
+
algorithms as such, or generated outputs. Commercial uses still require the
|
|
37
|
+
separate permission specified in LICENSE; this file is not a guarantee of legal
|
|
38
|
+
enforceability.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
include README.md LICENSE LICENSE-MIT.txt LICENSING.md pyproject.toml
|
|
2
|
+
include src/causalscience/__init__.py
|
|
3
|
+
include src/causalscience/demo.py
|
|
4
|
+
include docs/internal-library.md tests/test_public_api.py
|
|
5
|
+
include src/causalscience/bdscm/*.py src/causalscience/bdscm/data/tabdpt_openml.json src/causalscience/bdscm/NOTICE.txt
|
|
6
|
+
include tests/test_bdscm.py tests/data/bdscm_regression.json
|
|
7
|
+
include src/causalscience/CSCM.py tests/test_cscm.py
|
|
8
|
+
|
|
9
|
+
include src/causalscience/graph_tool.py src/causalscience/web/index.html src/causalscience/web/NOTICE.txt
|
|
10
|
+
include tests/test_weighting.py tests/test_graph_tool.py
|
|
11
|
+
include docs/installation.md docs/wiki/README.md
|
|
12
|
+
include tests/test_uca_defaults.py
|
|
13
|
+
include tests/test_uca_benchmark.py tutorials/benchmark_uca.py docs/uca-benchmark.md docs/uca-benchmark-results.json
|
|
14
|
+
include src/causalscience/estimators.py tests/test_graphless_estimators.py docs/graphless-estimators.md
|
|
15
|
+
include src/causalscience/effects.py tests/test_effects.py tutorials/benchmark_estimators.py docs/estimator-benchmark.md docs/estimator-benchmark-results.json
|
|
16
|
+
|
|
17
|
+
include tutorials/current-workflow.md
|
|
18
|
+
|
|
19
|
+
include src/causalscience/*.py src/causalscience/ENGINE_SOURCES.json src/causalscience/ENGINE_LICENSE.txt
|
|
20
|
+
|
|
21
|
+
include docs/indexed-identification.md docs/validation-history.md
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: CausalScience
|
|
3
|
+
Version: 0.1.0a13
|
|
4
|
+
Summary: Graph-based causal identification, mean estimation, and qualified UCA inference
|
|
5
|
+
Author: Yonghan Jung
|
|
6
|
+
Classifier: Development Status :: 3 - Alpha
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Classifier: Topic :: Scientific/Engineering
|
|
9
|
+
Requires-Python: >=3.11
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
License-File: LICENSE-MIT.txt
|
|
13
|
+
License-File: LICENSING.md
|
|
14
|
+
License-File: src/causalscience/ENGINE_LICENSE.txt
|
|
15
|
+
License-File: src/causalscience/ENGINE_SOURCES.json
|
|
16
|
+
Requires-Dist: numpy<3,>=1.24
|
|
17
|
+
Requires-Dist: pandas<4,>=2
|
|
18
|
+
Requires-Dist: networkx<4,>=2.8
|
|
19
|
+
Requires-Dist: scipy<2,>=1.10
|
|
20
|
+
Requires-Dist: scikit-learn<2,>=1.2
|
|
21
|
+
Requires-Dist: xgboost<4,>=2
|
|
22
|
+
Requires-Dist: osqp<2,>=0.6
|
|
23
|
+
Requires-Dist: tabulate<1,>=0.9
|
|
24
|
+
Requires-Dist: pyperclip<2,>=1.8
|
|
25
|
+
Requires-Dist: dill<0.5,>=0.3
|
|
26
|
+
Provides-Extra: plot
|
|
27
|
+
Requires-Dist: matplotlib<4,>=3.8; extra == "plot"
|
|
28
|
+
Requires-Dist: pyvis<1,>=0.3; extra == "plot"
|
|
29
|
+
Requires-Dist: plotly<7,>=5; extra == "plot"
|
|
30
|
+
Dynamic: license-file
|
|
31
|
+
|
|
32
|
+
# CausalScience
|
|
33
|
+
|
|
34
|
+
CausalScience is a functional distribution of the CausalEngine library from source commit `4bdf0bc38445b31a50cd384f7cbf766af23b2a23`.
|
|
35
|
+
|
|
36
|
+
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.
|
|
37
|
+
|
|
38
|
+
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.
|
|
39
|
+
|
|
40
|
+
CausalEngine is a Python library for structural causal model (SCM) simulation, graph-based identification,
|
|
41
|
+
and causal-effect estimation. It is an alpha research package (`0.1.0a13`).
|
|
42
|
+
Public imports use `causalscience`; **all runtime source is in `src/causalscience/`**.
|
|
43
|
+
|
|
44
|
+
<a id="cscm-quickstart"></a>
|
|
45
|
+
<a id="graphs-and-data"></a>
|
|
46
|
+
<a id="graph-free-point-estimators-010a13"></a>
|
|
47
|
+
|
|
48
|
+
## Choose your task
|
|
49
|
+
|
|
50
|
+
| What you have or need | Start here |
|
|
51
|
+
|---|---|
|
|
52
|
+
| Observed data and an assumed back-door/front-door/sequential formula | [Graph-free estimators](docs/graphless-estimators.md): `estimate_bd`, `estimate_sbd`, `estimate_fd`, `estimate_uca` |
|
|
53
|
+
| A causal graph and observed data | [Identify and estimate](docs/internal-library.md#identify-and-estimate-a-mean): `identify_query`, `fit_query_mean` |
|
|
54
|
+
| Simulated tasks and conditional average potential outcome (CAPO) targets | [Generators and truth](docs/internal-library.md#scm-generation-and-truth): `BDSCM`, `CSCM`, `CSCM_capo` |
|
|
55
|
+
| Average treatment effect (ATE) or conditional average treatment effect (CATE) | [Paired effects](docs/internal-library.md#ate-and-cate): `estimate_ate`, `estimate_cate` |
|
|
56
|
+
| Code to change | [Implementation map](docs/internal-library.md#implementation-map) or [Wiki](docs/wiki/README.md) |
|
|
57
|
+
|
|
58
|
+
A graph-free estimator executes your chosen identifying formula. It does not
|
|
59
|
+
infer or verify a causal graph from the data.
|
|
60
|
+
|
|
61
|
+
<a id="internal-lab-use"></a>
|
|
62
|
+
<a id="causalengine-package-installation"></a>
|
|
63
|
+
|
|
64
|
+
## Install
|
|
65
|
+
|
|
66
|
+
Use Python 3.11 or later in your project environment:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
python -m pip install CausalScience
|
|
70
|
+
python -m causalscience.demo
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Optional source-checkout installation requires access to the upstream repository;
|
|
74
|
+
from this distribution's source archive or prepared checkout, use `python -m pip install .`.
|
|
75
|
+
|
|
76
|
+
The installed demo runs from any directory. For source development, use
|
|
77
|
+
`python -m pip install --no-deps --no-build-isolation -e .` once the declared
|
|
78
|
+
dependencies are installed. See [installation](docs/installation.md) for virtual
|
|
79
|
+
environments, reproducible older pins and wheel delivery.
|
|
80
|
+
|
|
81
|
+
## One complete example
|
|
82
|
+
|
|
83
|
+
This binary synthetic example estimates the mean under action `A=1`. It is not
|
|
84
|
+
an ATE; the adjustment assumption is supplied by the caller.
|
|
85
|
+
|
|
86
|
+
```python
|
|
87
|
+
import numpy as np
|
|
88
|
+
import pandas as pd
|
|
89
|
+
from causalscience import estimate_bd
|
|
90
|
+
|
|
91
|
+
rng = np.random.default_rng(11)
|
|
92
|
+
c = rng.binomial(1, .5, 1200)
|
|
93
|
+
a = rng.binomial(1, .2 + .5*c)
|
|
94
|
+
y = rng.binomial(1, .1 + .3*c + .4*a)
|
|
95
|
+
data = pd.DataFrame(dict(C=c, A=a, Y=y))
|
|
96
|
+
fit = estimate_bd(data, treatment="A", outcome="Y", adjustment=["C"],
|
|
97
|
+
action=1, schema={name: "binary" for name in data}, num_boost_round=30)
|
|
98
|
+
assert fit["estimation_status"] == "ACCEPT"
|
|
99
|
+
assert fit["graph_verification"] == "not_run"
|
|
100
|
+
assert fit["causal_interval"] is None
|
|
101
|
+
print(fit["estimate"])
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Defaults use Unified Covariate Adjustment (UCA) full scores with XGBoost backward
|
|
105
|
+
regressions and separate normalized minimum-L2 weights. Graph-based default fitting
|
|
106
|
+
checks the Fixed-partition Multilinearity Criterion (FMC), then the Multilinearity
|
|
107
|
+
Criterion (MC) if needed; graph-free fitting uses the supplied functional.
|
|
108
|
+
Always inspect status and diagnostics. Successful fitting does not verify overlap,
|
|
109
|
+
causal assumptions, population consistency or causal confidence-interval coverage.
|
|
110
|
+
|
|
111
|
+
<a id="code-structure-wiki"></a>
|
|
112
|
+
<a id="indexed-tian-identification-and-finite-kpp-compilation"></a>
|
|
113
|
+
<a id="tutorials"></a>
|
|
114
|
+
<a id="references"></a>
|
|
115
|
+
<a id="documentation-and-maintained-tutorial"></a>
|
|
116
|
+
|
|
117
|
+
## Read more
|
|
118
|
+
|
|
119
|
+
- [Document](docs/internal-library.md): workflows, assumptions, API contracts and implementation map.
|
|
120
|
+
- [Six-API tutorial](tutorials/current-workflow.md): four graph-free means plus paired ATE/CATE.
|
|
121
|
+
- [Wiki](docs/wiki/README.md): detailed modules and method routes.
|
|
122
|
+
- [Indexed compiler reference](docs/indexed-identification.md): lower-level symbolic/finite tools.
|
|
123
|
+
- [Whole-call benchmark](docs/estimator-benchmark.md) and [shared-fit component pilot](docs/uca-benchmark.md): different timing scopes.
|
|
124
|
+
- [Historical validation](docs/validation-history.md): dated version-specific checks.
|
|
125
|
+
|
|
126
|
+
Browser editions: [Document](https://causalscience.ai/docs/causalengine/),
|
|
127
|
+
[Wiki](https://causalscience.ai/docs/causalengine/wiki/),
|
|
128
|
+
[Tutorial](https://causalscience.ai/docs/causalengine/tutorial/).
|
|
129
|
+
|
|
130
|
+
<a id="current-module-map"></a>
|
|
131
|
+
|
|
132
|
+
## Repository layout
|
|
133
|
+
|
|
134
|
+
| Directory | Responsibility |
|
|
135
|
+
|---|---|
|
|
136
|
+
| `src/causalscience/` | Single canonical runtime: public APIs, SCMs, criteria, score engine and HTML tool |
|
|
137
|
+
| `tests/` / `tests/checkout/` | Installed contracts / source and developer-tool regressions |
|
|
138
|
+
| `tutorials/` | Maintained walkthrough, demos, benchmarks and named SCM examples; notebooks are labeled historical |
|
|
139
|
+
| `docs/` | User guide, Wiki, assumptions, benchmarks and provenance |
|
|
140
|
+
| `experimental/backdoor_scm/` | Separate research component, outside the public distribution |
|
|
141
|
+
| `archived/` | Preserved historical material |
|
|
142
|
+
|
|
143
|
+
<a id="source-development-and-compatibility"></a>
|
|
144
|
+
|
|
145
|
+
After installing this distribution, run its adapted public API checks with
|
|
146
|
+
`python -B -m unittest discover -s tests -p test_public_api.py -v` from the source archive root.
|
|
147
|
+
Other upstream tests and tutorials retain their original namespace and need
|
|
148
|
+
namespace adaptation before running against this distribution.
|
|
149
|
+
Old flat imports such as `import SCM` are retired; use `causalscience.*` imports.
|
|
150
|
+
The [compatibility notes](docs/internal-library.md#source-development-and-compatibility)
|
|
151
|
+
cover external research scripts and frozen snapshots.
|
|
152
|
+
|
|
153
|
+
<a id="qualified-score-inference"></a>
|
|
154
|
+
<a id="engine-snapshots-and-license-scope"></a>
|
|
155
|
+
<a id="status-and-limitations"></a>
|
|
156
|
+
|
|
157
|
+
## Boundaries and license
|
|
158
|
+
|
|
159
|
+
Default full-score execution supports declared discrete actions; continuous
|
|
160
|
+
fixed-point actions and unsupported compiler/design cases are declined. CATE
|
|
161
|
+
requires a supported baseline anchor and learning assumptions; it returns
|
|
162
|
+
predictions, not automatic pointwise causal intervals. `CSCM_capo` has fast direct
|
|
163
|
+
truth lookup but conditional centering can make mixed-X generation expensive.
|
|
164
|
+
See [limitations](docs/internal-library.md#limitations).
|
|
165
|
+
|
|
166
|
+
[LICENSE](LICENSE) is the CausalEngine Noncommercial License 1.0.
|
|
167
|
+
[LICENSING.md](LICENSING.md) preserves prior MIT grants and separate rights.
|
|
168
|
+
[Engine provenance](src/causalscience/ENGINE_SOURCES.json) records current canonical
|
|
169
|
+
hashes and earlier snapshots.
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
# CausalScience
|
|
2
|
+
|
|
3
|
+
CausalScience is a functional distribution of the CausalEngine library from source commit `4bdf0bc38445b31a50cd384f7cbf766af23b2a23`.
|
|
4
|
+
|
|
5
|
+
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.
|
|
6
|
+
|
|
7
|
+
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.
|
|
8
|
+
|
|
9
|
+
CausalEngine is a Python library for structural causal model (SCM) simulation, graph-based identification,
|
|
10
|
+
and causal-effect estimation. It is an alpha research package (`0.1.0a13`).
|
|
11
|
+
Public imports use `causalscience`; **all runtime source is in `src/causalscience/`**.
|
|
12
|
+
|
|
13
|
+
<a id="cscm-quickstart"></a>
|
|
14
|
+
<a id="graphs-and-data"></a>
|
|
15
|
+
<a id="graph-free-point-estimators-010a13"></a>
|
|
16
|
+
|
|
17
|
+
## Choose your task
|
|
18
|
+
|
|
19
|
+
| What you have or need | Start here |
|
|
20
|
+
|---|---|
|
|
21
|
+
| Observed data and an assumed back-door/front-door/sequential formula | [Graph-free estimators](docs/graphless-estimators.md): `estimate_bd`, `estimate_sbd`, `estimate_fd`, `estimate_uca` |
|
|
22
|
+
| A causal graph and observed data | [Identify and estimate](docs/internal-library.md#identify-and-estimate-a-mean): `identify_query`, `fit_query_mean` |
|
|
23
|
+
| Simulated tasks and conditional average potential outcome (CAPO) targets | [Generators and truth](docs/internal-library.md#scm-generation-and-truth): `BDSCM`, `CSCM`, `CSCM_capo` |
|
|
24
|
+
| Average treatment effect (ATE) or conditional average treatment effect (CATE) | [Paired effects](docs/internal-library.md#ate-and-cate): `estimate_ate`, `estimate_cate` |
|
|
25
|
+
| Code to change | [Implementation map](docs/internal-library.md#implementation-map) or [Wiki](docs/wiki/README.md) |
|
|
26
|
+
|
|
27
|
+
A graph-free estimator executes your chosen identifying formula. It does not
|
|
28
|
+
infer or verify a causal graph from the data.
|
|
29
|
+
|
|
30
|
+
<a id="internal-lab-use"></a>
|
|
31
|
+
<a id="causalengine-package-installation"></a>
|
|
32
|
+
|
|
33
|
+
## Install
|
|
34
|
+
|
|
35
|
+
Use Python 3.11 or later in your project environment:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
python -m pip install CausalScience
|
|
39
|
+
python -m causalscience.demo
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Optional source-checkout installation requires access to the upstream repository;
|
|
43
|
+
from this distribution's source archive or prepared checkout, use `python -m pip install .`.
|
|
44
|
+
|
|
45
|
+
The installed demo runs from any directory. For source development, use
|
|
46
|
+
`python -m pip install --no-deps --no-build-isolation -e .` once the declared
|
|
47
|
+
dependencies are installed. See [installation](docs/installation.md) for virtual
|
|
48
|
+
environments, reproducible older pins and wheel delivery.
|
|
49
|
+
|
|
50
|
+
## One complete example
|
|
51
|
+
|
|
52
|
+
This binary synthetic example estimates the mean under action `A=1`. It is not
|
|
53
|
+
an ATE; the adjustment assumption is supplied by the caller.
|
|
54
|
+
|
|
55
|
+
```python
|
|
56
|
+
import numpy as np
|
|
57
|
+
import pandas as pd
|
|
58
|
+
from causalscience import estimate_bd
|
|
59
|
+
|
|
60
|
+
rng = np.random.default_rng(11)
|
|
61
|
+
c = rng.binomial(1, .5, 1200)
|
|
62
|
+
a = rng.binomial(1, .2 + .5*c)
|
|
63
|
+
y = rng.binomial(1, .1 + .3*c + .4*a)
|
|
64
|
+
data = pd.DataFrame(dict(C=c, A=a, Y=y))
|
|
65
|
+
fit = estimate_bd(data, treatment="A", outcome="Y", adjustment=["C"],
|
|
66
|
+
action=1, schema={name: "binary" for name in data}, num_boost_round=30)
|
|
67
|
+
assert fit["estimation_status"] == "ACCEPT"
|
|
68
|
+
assert fit["graph_verification"] == "not_run"
|
|
69
|
+
assert fit["causal_interval"] is None
|
|
70
|
+
print(fit["estimate"])
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Defaults use Unified Covariate Adjustment (UCA) full scores with XGBoost backward
|
|
74
|
+
regressions and separate normalized minimum-L2 weights. Graph-based default fitting
|
|
75
|
+
checks the Fixed-partition Multilinearity Criterion (FMC), then the Multilinearity
|
|
76
|
+
Criterion (MC) if needed; graph-free fitting uses the supplied functional.
|
|
77
|
+
Always inspect status and diagnostics. Successful fitting does not verify overlap,
|
|
78
|
+
causal assumptions, population consistency or causal confidence-interval coverage.
|
|
79
|
+
|
|
80
|
+
<a id="code-structure-wiki"></a>
|
|
81
|
+
<a id="indexed-tian-identification-and-finite-kpp-compilation"></a>
|
|
82
|
+
<a id="tutorials"></a>
|
|
83
|
+
<a id="references"></a>
|
|
84
|
+
<a id="documentation-and-maintained-tutorial"></a>
|
|
85
|
+
|
|
86
|
+
## Read more
|
|
87
|
+
|
|
88
|
+
- [Document](docs/internal-library.md): workflows, assumptions, API contracts and implementation map.
|
|
89
|
+
- [Six-API tutorial](tutorials/current-workflow.md): four graph-free means plus paired ATE/CATE.
|
|
90
|
+
- [Wiki](docs/wiki/README.md): detailed modules and method routes.
|
|
91
|
+
- [Indexed compiler reference](docs/indexed-identification.md): lower-level symbolic/finite tools.
|
|
92
|
+
- [Whole-call benchmark](docs/estimator-benchmark.md) and [shared-fit component pilot](docs/uca-benchmark.md): different timing scopes.
|
|
93
|
+
- [Historical validation](docs/validation-history.md): dated version-specific checks.
|
|
94
|
+
|
|
95
|
+
Browser editions: [Document](https://causalscience.ai/docs/causalengine/),
|
|
96
|
+
[Wiki](https://causalscience.ai/docs/causalengine/wiki/),
|
|
97
|
+
[Tutorial](https://causalscience.ai/docs/causalengine/tutorial/).
|
|
98
|
+
|
|
99
|
+
<a id="current-module-map"></a>
|
|
100
|
+
|
|
101
|
+
## Repository layout
|
|
102
|
+
|
|
103
|
+
| Directory | Responsibility |
|
|
104
|
+
|---|---|
|
|
105
|
+
| `src/causalscience/` | Single canonical runtime: public APIs, SCMs, criteria, score engine and HTML tool |
|
|
106
|
+
| `tests/` / `tests/checkout/` | Installed contracts / source and developer-tool regressions |
|
|
107
|
+
| `tutorials/` | Maintained walkthrough, demos, benchmarks and named SCM examples; notebooks are labeled historical |
|
|
108
|
+
| `docs/` | User guide, Wiki, assumptions, benchmarks and provenance |
|
|
109
|
+
| `experimental/backdoor_scm/` | Separate research component, outside the public distribution |
|
|
110
|
+
| `archived/` | Preserved historical material |
|
|
111
|
+
|
|
112
|
+
<a id="source-development-and-compatibility"></a>
|
|
113
|
+
|
|
114
|
+
After installing this distribution, run its adapted public API checks with
|
|
115
|
+
`python -B -m unittest discover -s tests -p test_public_api.py -v` from the source archive root.
|
|
116
|
+
Other upstream tests and tutorials retain their original namespace and need
|
|
117
|
+
namespace adaptation before running against this distribution.
|
|
118
|
+
Old flat imports such as `import SCM` are retired; use `causalscience.*` imports.
|
|
119
|
+
The [compatibility notes](docs/internal-library.md#source-development-and-compatibility)
|
|
120
|
+
cover external research scripts and frozen snapshots.
|
|
121
|
+
|
|
122
|
+
<a id="qualified-score-inference"></a>
|
|
123
|
+
<a id="engine-snapshots-and-license-scope"></a>
|
|
124
|
+
<a id="status-and-limitations"></a>
|
|
125
|
+
|
|
126
|
+
## Boundaries and license
|
|
127
|
+
|
|
128
|
+
Default full-score execution supports declared discrete actions; continuous
|
|
129
|
+
fixed-point actions and unsupported compiler/design cases are declined. CATE
|
|
130
|
+
requires a supported baseline anchor and learning assumptions; it returns
|
|
131
|
+
predictions, not automatic pointwise causal intervals. `CSCM_capo` has fast direct
|
|
132
|
+
truth lookup but conditional centering can make mixed-X generation expensive.
|
|
133
|
+
See [limitations](docs/internal-library.md#limitations).
|
|
134
|
+
|
|
135
|
+
[LICENSE](LICENSE) is the CausalEngine Noncommercial License 1.0.
|
|
136
|
+
[LICENSING.md](LICENSING.md) preserves prior MIT grants and separate rights.
|
|
137
|
+
[Engine provenance](src/causalscience/ENGINE_SOURCES.json) records current canonical
|
|
138
|
+
hashes and earlier snapshots.
|