Privacy-preserving disease prediction

Four hospitals. One heart model. Zero shared records.

We trained a heart disease predictor across four hospitals with federated learning (FedAvg and FedProx). Each hospital kept its patients’ records and sent only model weights, and the shared model matched one trained on all the data pooled together.

DSA0410 Fundamentals of Data Science SIMATS Engineering, Chennai
The problem

Three things stop hospitals from building one model together

01 · Privacy
Can’t pool

HIPAA, GDPR and India’s DPDP Act 2023 restrict moving patient records, and one central copy is one big target for breaches.

02 · Small, skewed data
123–303

patients per hospital, with heart disease in 36% to 93% of them. No single hospital has enough, or typical enough, data alone.

03 · Non-IID drift
FedAvg drifts

Different patients and different missing tests pull each hospital’s local model away from the shared one.

Goal: learn from all four hospitals without moving a single record, match the accuracy of pooled training, and stay stable on non-IID data.

How it works

The model travels; the data stays home

Every round, the server sends the current model out, each hospital trains it on its own patients, and only the updated weights come back to be averaged.

One federated round

Round 0 of 50
  1. Server sends the global model to all 4 hospitals.
  2. Each hospital trains it for 5 epochs on its own records.
  3. Hospitals send back only their updated weights.
  4. Server averages them, weighted by each hospital’s data size.

Why FedProx

After local training, each hospital’s weights sit some distance from the global model: that is client drift. FedProx adds a penalty that keeps them on a shorter leash.

Local epochs per round
Mean client drift
0.122
Test accuracy
81.2%
FedProx local loss = Fk(w) + (μ/2)·‖w − wglobal‖² , μ = 1
Dataset

920 patients from four hospitals that look nothing alike

UCI Heart Disease dataset (Janosi, Steinbrunn, Pfisterer and Detrano, 1988). 13 clinical features per patient; label = heart disease present or not. Each hospital is one federated client.

Heart diseaseNo diseaseRight column: disease rate
Results

Federated training matched pooled training, and helped the weakest hospitals most

Means over 10 random 80/20 splits per hospital. Every target set at the project review was met.

81.2%
FedProx accuracy
target ≥ 80% · met
+0.2
points vs centralised
target within 3 · met
0
raw records shared
target 0 · met
0.884
ROC-AUC
target ≥ 0.85 · met
VA Long Beach gains most: ROC-AUC 0.60 alone, 0.71 federated
ROC-AUC per hospital · logistic regression
Local-onlyFedProxCentralised
FedProx keeps hospitals closer: drift 0.13 vs 0.29 after 50 rounds
Mean client drift per round · 5 local epochs
FedAvgFedProx

All methods compared

MethodAccuracy (%)Precision (%)Recall (%)F1-score (%)ROC-AUC (%)

Local-only scores highest overall only because Switzerland’s own model predicts “disease” for almost everyone (93.5% of its patients have it): its recall there is 99% but its ROC-AUC just 0.72. Per hospital, federation helps VA Long Beach and Switzerland, and Cleveland, the largest and most complete dataset, does slightly better alone.

Try the model

Run the trained FedProx model on a patient

This is the actual global model from our experiment (logistic regression, main split). It runs in your browser; nothing you enter leaves this page.

Load an example patient from the dataset:
years
mm Hg
mg/dl · leave blank if not recorded
beats per minute
mm, exercise vs rest
Predicted probability of heart disease
–
–
0%30%60%100%

A student project for DSA0410, not a medical device. It was trained on 735 patients whose records were collected in the 1980s and gives a statistical estimate, not a diagnosis. Anyone worried about their heart should see a doctor.

References

Papers and data behind the project

  1. McMahan et al. (2017). Communication-Efficient Learning of Deep Networks from Decentralized Data. AISTATS 2017.
  2. Li et al. (2020). Federated Optimization in Heterogeneous Networks. MLSys 2020.
  3. Brisimi et al. (2018). Federated Learning of Predictive Models from Federated Electronic Health Records. Int. J. Medical Informatics 112.
  4. Rieke et al. (2020). The Future of Digital Health with Federated Learning. npj Digital Medicine 3, 119.
  5. Janosi, Steinbrunn, Pfisterer & Detrano (1988). Heart Disease [Dataset]. UCI Machine Learning Repository. doi.org/10.24432/C52P4X