@javier/iron-deficiency
flwr new @javier/iron-deficiencyFederated Iron-Deficiency Classification
This Flower app trains a PyTorch binary classifier to identify iron deficiency from routine complete blood count measurements and age. Iron deficiency is defined as ferritin below 15 ng/mL.
The federation has four clients, each representing a different NHANES survey cycle: 2005–2006, 2015–2016, 2017–2018, and 2021–2023. Each client trains on its own locally standardized data.
Run on SuperGrid
The app is designed for a SuperGrid deployment federation with four SuperNodes. Before connecting a SuperNode, first register its public key with SuperGrid and then add the registered SuperNode to the deployment federation of interest. See Create and Manage Federations on SuperGrid and Connect SuperNodes to SuperGrid.
Each SuperNode must be assigned exactly one survey cycle through its node configuration. For example:
flower-supernode \ --superlink fleet-supergrid.flower.ai:443 \ --auth-supernode-private-key ~/path/to/supernode/private/key \ --node-config "CYCLES='2005-2006'" \ --allow-runtime-dependency-installation # optional
Launch the other three SuperNodes in the same way, setting CYCLES to 2015-2016, 2017-2018, and 2021-2023, respectively. The CYCLES argument is required because it determines which NHANES partition the client loads.
Once the four SuperNodes are online and part of the federation, follow Run Flower Apps on SuperGrid to submit the app.
The dataset is built from the NHANES demographics, complete blood count, and ferritin components. It includes women aged 18–49 with complete measurements, using 13 blood-count variables plus age as model features. Missing files are downloaded from NHANES and cached when each client first loads its data.
Weights & Biases
To upload the aggregated strategy metrics after a run, set wandb-api-key in the [tool.flwr.app.config] section of pyproject.toml. Leave it empty to disable W&B logging.
Ways to improve the app
For background and step-by-step guidance, follow the Flower tutorial series: Get started with Flower, Write your first Flower App, Write your first Flower App with PyTorch, Use a federated learning strategy, Customize a Flower Strategy, and Communicate custom Messages.
Fetch the app into a local directory so you can modify and experiment with it:
flwr new @javier/iron-deficiency
Possible next steps for experimenting with and improving the app include:
- Tune hyperparameters such as the learning rate, weight decay, batch size, and number of training rounds.
- Change the model architecture or compare it with other models suitable for tabular clinical data.
- Try a different built-in federated aggregation strategy.
- Create a custom aggregation strategy tailored to differences between the four NHANES cohorts.
After making your changes, submit the app to your SuperGrid federation:
cd iron-deficiency flwr run . --federation @<username>/<federation-name> supergrid