Skip to main content

BioSilo

Naturally partitioned biomedical datasets for federated learning.

BioSilo preserves client boundaries already present in source data, such as hospitals, imaging institutions, and sequencing studies.

Install

Install BioSilo from PyPI:

pip install biosilo

BioSilo requires Python 3.9 or newer. The base installation depends only on NumPy. Install the optional dependencies for the datasets you intend to use:

pip install "biosilo[eicu]"
pip install "biosilo[scrnaseq]"
pip install "biosilo[brats]"
pip install "biosilo[tcga]"
pip install "biosilo[all]"       # every dataset extra

For development, clone the repository and install it in editable mode:

git clone https://github.com/briannamueller/BioSilo.git
cd BioSilo
python3 -m venv .venv && source .venv/bin/activate
pip install -e ".[all]"

Quickstart

biosilo.generate(...) creates or reuses a partition on disk. biosilo.load(...) opens a completed partition.

The built-in synthetic dataset provides a quick installation check:

import biosilo

path = biosilo.generate("synthetic")

p = biosilo.load("synthetic", partition=path.name)
p.num_clients        # 3
p.client_ids         # ['site-0', 'site-1', 'site-2']

X, y, groups = p.client(0, "train")
X.shape, y.shape     # ((18, 5), (18,))

Dataset setup and storage

Each supported dataset has a guide in docs/datasets/ that explains how to obtain and prepare its required data. Complete those steps before generating a partition.

BioSilo uses data/ in the current working directory as its default root:

data/
├── _raw/
│   └── <Dataset>/            # source data used for generation
├── _cache/
│   └── <Dataset>/            # reusable preprocessing results
└── <Dataset>/
    └── <partition_id>/       # completed generated partition

When applicable, source_dir defaults to <root>/_raw/<Dataset>/ and cache_dir defaults to <root>/_cache/<Dataset>/. Completed partitions are always written to <root>/<Dataset>/<partition_id>/.

For example, with the eICU source data saved under data/_raw/eICU/, the following generates a partition using the default paths:

path = biosilo.generate(
    "eICU",
    task="mortality_24h",             # docs/datasets/eicu.md lists all eight
    num_clients=10,
)
p = biosilo.load("eICU", partition=path.name)

The reusable output from the expensive eICU preprocessing pipeline is saved under data/_cache/eICU/ and the completed partition is saved under data/eICU/<partition_id>/.

To override the default locations, pass root, source_dir, or cache_dir when generating a partition. The root can also be set globally with BIOSILO_DATA_ROOT.

By default, generate reuses a completed partition for the same configuration. New partitions are built and validated in a temporary directory before being moved to their final location, so a failed build does not leave a partial partition behind. Pass overwrite=True only when you want to regenerate and replace an existing partition.

biosilo.available() lists the datasets supported by generation and loading. Each dataset's guide states whether BioSilo also provides a download helper.

The data contract

Some datasets contain multiple samples from the same subject, forming a group. Examples include multiple brain-image slices from one subject and multiple ICU stays from one patient. During generation, BioSilo ensures that no group ID appears in both a client’s training and test data to prevent subject-level data leakage.

Return Meaning
X Input data: a NumPy array or, when each sample has multiple input components, a named tuple of arrays.
y int array, one label per sample.
groups One group ID per sample, or None when the samples are independent.

Load one client’s training or test data with:

X, y, groups = p.client(0, "train")

BioSilo only creates training and test splits, leaving users to define validation splits according to their needs. For datasets that provide group IDs, pass groups to a group-aware splitter such as scikit-learn’s GroupShuffleSplit so that all samples from one subject remain together.

Most datasets return a single input array, so X[i] contains the complete input for sample i. Some datasets return multiple input arrays per sample. In eICU, for example, each ICU stay has time-series measurements and static patient features:

time_series = X.ts[i]
static_features = X.static[i]

Datasets stored as memmapped .npy files (currently BraTS) are not loaded into memory in their entirety. np.memmap subclasses ndarray, so this does not change how you index them. Other datasets use compressed per-client .npz files.

Datasets

Dataset Task Clients Sample Groups
eICU binary: mortality, length of stay, vasopressor infusion, or respiratory-support onset hospital ts (T, n_ts) + static (n_static,) person
scRNAseq cell-type annotation, 12 classes sequencing study (n_genes,) none
BraTS binary: tumour present per axial slice imaging institution (4, 240, 240) subject
TCGA cancer type, stage, or survival contributing hospital (n_genes,) patient

No dataset is redistributed here. Each dataset has a dedicated guide in docs/datasets/ covering data acquisition, preprocessing, parameters, and licensing.

Contributing

The dataset-module contract, cache-versioning policy, and contributor test workflow are in CONTRIBUTING.md.

Citing BioSilo

CITATION.cff carries the machine-readable citation; GitHub renders it under Cite this repository. The datasets have their own citations, listed on each page in docs/datasets/, and those are the ones the data providers require.

Licence

MIT, covering the source code only. See LICENSE.

The datasets are not MIT. Each carries its own terms, and BioSilo redistributes none of them. See the per-dataset pages in docs/datasets/.

Metadata

Release files for biosilo 0.1.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 biosilo 0.1.0
File Size Uploaded
biosilo-0.1.0.tar.gz 109.1 kB Details

Built distribution (wheel)

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

Total release size: 195.7 kB

Release files / biosilo-0.1.0.tar.gz

Download URL biosilo-0.1.0.tar.gz
Size 109.1 kB
Tags Source
SHA-256 checksum
How to use checksums
c8266f249749f4e377dac4a549324be0ea5f3cb1de233714614be2f5262d2846
BLAKE2b-256 checksum
How to use checksums
f953a65f0620c38f232854d2f53b66e192cde518d48766b9e13ff63c03bcbacc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 8, 2026.

Transparency log

Release files / biosilo-0.1.0-py3-none-any.whl

Download URL biosilo-0.1.0-py3-none-any.whl
Size 86.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
edf05043cfacd0245b66c93b41605abb34cd04ab7ff0661e121f36e3ec302344
BLAKE2b-256 checksum
How to use checksums
115672cb1fdb6dfff795c65ebeb13ef97366a695cfa31e0c328273dc57a6fcc5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 8, 2026.

Transparency log

Release history Release notifications | RSS feed

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

This release

0.1.0 This release

2 release files

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