@chongshenng/fed-ventilation-xgboost
flwr new @chongshenng/fed-ventilation-xgboostFederated Clinical Risk XGBoost
This is a basic Flower app that trains a federated XGBoost binary classifier on the public Pima Indians Diabetes Database. The model predicts diabetes (0 or 1) from eight numeric clinical measurements.
Dataset
The app downloads the headerless CSV from the public dataset mirror the first time a SuperNode needs it. This is the standard Pima dataset from the UCI Machine Learning Repository. The app adds stable column names and caches the result at .cache/uci-diabetes.csv (or at the path supplied in dataset-path). No dataset is committed here.
The dataset contains 768 rows and eight features: pregnancies, glucose, blood pressure, skin thickness, insulin, BMI, diabetes pedigree, and age. The outcome column is the binary label.
For reproducibility, all clients use a fixed-seed permutation (2024) and receive one contiguous partition of the shuffled rows. Each partition uses its first 80% for local training and its final 20% for local validation. With the default three SuperNodes, this creates three deterministic data owners with 256 rows each.
Connect SuperNodes to SuperGrid
This app is intended for a deployment federation with three actual SuperNodes. Install the app dependencies on each data-owner machine:
uv sync --python 3.12 --frozen
Start one SuperNode per data owner and point all three at the deployment SuperLink. Each node gets one partition through its node configuration:
flower-supernode \ --superlink fleet-supergrid.flower.ai:443 \ --auth-supernode-private-key ~/path/to/supernode/private/key \ --node-config "partition-id=0 num-partitions=3" \ --allow-runtime-dependency-installation # Repeat with partition-id=1 and partition-id=2 on the other two nodes.
--allow-runtime-dependency-installation is optional when the SuperNode image already contains the app dependencies.
Submit the app from the researcher machine with the deployment federation's normal Flower command:
uvx flwr run . --federation @<username>/<federation-name> supergrid
The runtime downloads the dataset independently on each SuperNode. To use a different local copy, add dataset-path to that SuperNode's node configuration. The app uses Flower's Message API (ServerApp, ClientApp, Message, ArrayRecord, and MetricRecord) and FedXgbBagging.
Use case
Hospitals and ICUs can use this workflow to train a shared XGBoost risk model without sharing patient records. The bundled public diabetes dataset is a lightweight stand-in for validating federation, and is not a ventilation outcome dataset. The original app's hospital-specific ventilation schema is not distributed here.
Project layout
. ├── fed_ventilation_xgboost │ ├── __init__.py │ ├── client_app.py │ ├── server_app.py │ └── task.py ├── pyproject.toml ├── README.md └── LICENSE
Attribution
Dataset citation: Dua, D. and Graff, C. (2019), UCI Machine Learning Repository, Pima Indians Diabetes Database. The dataset is distributed under the terms stated by UCI.