Skip to main content

fedcausal

CI Docs PyPI Python License

fedcausal learns causal structure from data split across sites that cannot share them. The sites send only what each method needs, never their rows:

Estimator Data What crosses the network
FedGES Discrete or continuous, across sites Structures and scores
FedRCD Continuous, linear non-Gaussian, across sites Additive moment sums

Both follow scikit-learn's conventions: hyperparameters go to the constructor, fit learns, and results end in an underscore. They run in one process for experiments, or over Flower across real machines with the same round loop. Learning from data in one place (GES, XGES, the order and exact searches, and the scores, graphs and metrics the federated methods build on) is the job of causalbase, which fedcausal depends on.

Installation

pip install fedcausal

This installs causalbase with it. The Flower transport is an extra, pip install "fedcausal[federated]", and Flower's simulation engine, which runs on Ray, another one, pip install "fedcausal[federated-simulation]".

Quick start

from causalbase.datasets import load_alarm
from fedcausal import FedGES
from fedcausal.data import contiguous_split

data = load_alarm().data  # 37 variables, 5000 rows, bundled with causalbase

sites = contiguous_split(data, 5)  # or one DataFrame per site
federated = FedGES(n_jobs=-1).fit(sites)  # the sites learn in parallel
federated.dag_, federated.history_
from fedcausal import FedRCD

model = FedRCD().fit([x_site1, x_site2, x_site3])  # one array or DataFrame per site
model.causal_order_, model.coef_

How the package is organised

Layer Modules Needs
The methods fedcausal.fedges, fusion, lingam, data (the site splitters) causalbase; they run in one process
The transport fedcausal.flower pip install "fedcausal[federated]"

The methods never import Flower, and tests/test_layout.py checks that, along with a run with Flower made unimportable. Importing fedcausal.flower without the extra fails with a message naming it.

Documentation

Development

git clone https://github.com/ptorrijos99/fedcausal
cd fedcausal
pip install -e ".[dev,federated]"
pytest

CONTRIBUTING.md has the checks a pull request must pass; the documentation builds with pip install -e ".[docs,federated]" and sphinx-build -b html docs docs/_build/html.

Citing

If you use FedGES, please cite:

Torrijos, P., Gámez, J.A. & Puerta, J.M. FedGES: A Federated Learning Approach for Bayesian Network Structure Learning. Machine Learning 115, 9 (2026). https://doi.org/10.1007/s10994-025-06939-2

and for FedRCD:

Torrijos, P., Stella, F., Gámez, J.A. & Puerta, J.M. Federated Causal Discovery via Regression-Directed Cumulants. Probabilistic Graphical Models (PGM), 2026.

CITATION.cff carries both, for GitHub's "Cite this repository" button.

License

MIT. See LICENSE.

Metadata

Release files for fedcausal 1.0.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 fedcausal 1.0.0
File Size Uploaded Provenance Actions
fedcausal-1.0.0.tar.gz 101.9 kB With provenance Details for fedcausal-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for fedcausal 1.0.0
File Interpreter ABI Platform Actions
fedcausal-1.0.0-py3-none-any.whl Python 3 none any Details for fedcausal-1.0.0-py3-none-any.whl

Total release size: 152.3 kB

Release files / fedcausal-1.0.0.tar.gz

Download URL fedcausal-1.0.0.tar.gz
Size 101.9 kB
Tags Source
SHA-256 checksum
How to use checksums
5e2d3d5d0f61027b4b55a3ceb20321799fc9adbc24a6e20835739e6e13615d20
BLAKE2b-256 checksum
How to use checksums
dba9f2f3ec6abb113793ab27c73041323d0a56ec956d788ef93b4004a56cd44b
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 27, 2026.

Transparency log

Release files / fedcausal-1.0.0-py3-none-any.whl

Download URL fedcausal-1.0.0-py3-none-any.whl
Size 50.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
595f8b6dd659e580ee3f9e4dfb9fa73e4a7917c954b9d2bee66595339dfb7356
BLAKE2b-256 checksum
How to use checksums
ade7e7bbd8a6193a9fbf02b98c46b705942ece3c815d4f3b1080aaf9f5bf31d1
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 27, 2026.

Transparency log

Security for fedcausal 1.0.0

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.

Select from 2 files

Attestation for fedcausal-1.0.0.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 27, 2026.

Transparency log

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.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files Full provenance

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