This release is a pre-release and may not be stable for production use.
tramdag: Interpretable Neural Causal Models (TRAM-DAGs) in PyTorch
TRAM-DAGs model each variable of a structural causal model with a monotone normalizing flow, the statistician's transformation model. The whole model is one triangular normalizing flow from iid standard-logistic latents to the observed variables. Its triangular structure is exactly your causal DAG. One fit on observational data answers all three rungs of Pearl's causal hierarchy: observational, interventional (the do-operator) and counterfactual (abduction). The model keeps interpretable effects: every linear-shift coefficient is a log-odds ratio, as in a classical proportional-odds model.
Beate Sick & Oliver Dürr, Interpretable Neural Causal Models with TRAM-DAGs, CLeaR 2025 (arXiv:2503.16206). This repository is the reference implementation, in PyTorch on zuko. It replicates the paper's experiments under continuous integration.
Start here
The demo notebook is the introduction. It fits the paper's bimodal benchmark, walks the three rungs, and checks every answer against analytic ground truth. It runs on CPU in a few minutes, in Colab or locally.
Install
uv add tramdag or pip install tramdag installs the package from PyPI. The
plots extra (tramdag[plots]) adds matplotlib for the figures. A clone with
uv sync gives the development setup (CONTRIBUTING.md).
Documentation
The documentation site publishes the guides, the executed notebooks and the API reference.
- The model:
docs/model.mdanddocs/notation.md - Reading a fitted model:
docs/interpretation.md - Fitting:
docs/fitting.md - Treatment effects that vary with covariates:
docs/varying-coefficients.mdanddocs/scores.md - The design of the package:
docs/architecture.mdanddocs/code-map.md - The paper replications:
docs/paper-replication.mdandexperiments/README.md - The tests:
tests/README.md - The notebooks:
notebooks/README.md
Use of AI tools
LLM coding assistants helped to develop this project. The authors reviewed all content and take responsibility for it.
Citation
If you use tramdag, please cite the method paper:
@inproceedings{sick2025tramdag,
title = {Interpretable Neural Causal Models with {TRAM-DAGs}},
author = {Sick, Beate and D{\"u}rr, Oliver},
booktitle = {Proceedings of the 4th Conference on Causal Learning and Reasoning (CLeaR)},
series = {Proceedings of Machine Learning Research},
volume = {275},
pages = {606-630},
year = {2025},
eprint = {2503.16206},
url = {https://arxiv.org/abs/2503.16206},
}
Metadata
Release files for tramdag 1.0.0rc2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| tramdag-1.0.0rc2.tar.gz | 68.2 kB | With provenance | Details for tramdag-1.0.0rc2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| tramdag-1.0.0rc2-py3-none-any.whl | Python 3 | none | any | Details for tramdag-1.0.0rc2-py3-none-any.whl |
Total release size: 143.9 kB
Release files / tramdag-1.0.0rc2.tar.gz
| Download URL | tramdag-1.0.0rc2.tar.gz |
|---|---|
| Size | 68.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e8dbf229050a88d2e1b749d17015e1256168217aefea67034439b0f4dc691fc8
|
|
BLAKE2b-256 checksum How to use checksums |
a6ed49a3852a8b49bab78fc8a59b26a17308d31b172b13774e6c1b78ea0aa5f3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.
Transparency logRelease files / tramdag-1.0.0rc2-py3-none-any.whl
| Download URL | tramdag-1.0.0rc2-py3-none-any.whl |
|---|---|
| Size | 75.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
07f789f0a5413d8cd7b12b2f376a2aab11cebcc8fe8fc52165339b3f55cd9f18
|
|
BLAKE2b-256 checksum How to use checksums |
8bbbdc605973214331f1a754c8d7fe218bd6c718d0ffda3238d32c7672845e47
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.
Transparency logSecurity for tramdag 1.0.0rc2
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for tramdag-1.0.0rc2.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.
Transparency logA 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.