← All projects
Live model · deployed on Render
MLOps · Production ML · Explainable AI

Hospital Readmission MLOps

A production pipeline that predicts whether a diabetic patient will be readmitted within 30 days, from raw data to a live, monitored API with a full clinical interface and explainable predictions on top.

Role
ML Engineer (team)
Course
MLOps · IE
Year
2026
Stack
XGBoost · MLflow · FastAPI · Docker
The results

Measured on real data.

Every number here comes from the model's own test set of 9,970 patients, not a demo. This is an imbalanced problem, so the model is tuned to catch readmissions rather than to look good on raw accuracy.

Patients evaluated
9,970
Held-out test set
Overall accuracy
66%
Correct predictions
Readmissions caught
51%
Recall on readmitted patients
Precision
17%
Of flagged patients, share that readmit
Explainable by design

A score you can read.

Take one example patient, scored at 30.8% risk of readmission within 30 days by XGBoost-Readmit-V4. That is 2.7 times the average patient, whose actual readmission rate was 11.3%. The SHAP chart ranks what drove that number: red pushes the risk up, teal pulls it down, so the score is never a black box.

Model interpretability · SHAP

Raises riskLowers risk
How it performs

Where it is right, and wrong.

The confusion matrix is the honest view: each cell is the share of its own row, so the bottom row is recall and the top row is specificity. Of the 1,124 patients who did come back, the model caught 50.8%; of the 8,846 who did not, it cleared 68.4%. With only 11% of patients actually readmitted, it leans toward catching them, which trades precision for recall, and it has to pass a PR-AUC quality gate before it can ship. Hover or tab into a cell for the patient count behind each share.

Confusion matrix · 9,970 patients

Shaded by row: each row shows how the model treated that group of patients
Predicted: NoPredicted: YesPatients
Actual: No8,846 patients 68.4%6,052 patients · True negative 31.6%2,794 patients · False positive 8,846did not readmit
Actual: Yes1,124 patients 49.2%553 patients · False negative 50.8%571 patients · True positive 1,124readmitted

Of the 8,846 patients who did not readmit, 6,052 were correctly cleared (true negative) and 2,794 were wrongly flagged (false positive). Of the 1,124 who did readmit, 571 were caught (true positive) and 553 were missed (false negative).

Who gets flagged

An imbalanced problem.

This is the cost of tuning for recall. Only 11.3% of the test set actually readmitted within 30 days, but the model flags 33.8% of patients as likely to: three times as many people as come back. That is a deliberate trade. A missed readmission is a patient who returns unprepared, while a false flag is a patient who gets a follow-up call they may not have needed, so the model is set to over-flag rather than under-catch.

Flagged versus actual · 9,970 patients

The pipeline

Built to last.

Feature engineering feeds experiment tracking in MLflow. The champion model is served through FastAPI, packaged with Docker, watched for drift with Evidently, and shipped through CI/CD to a live cloud deployment. The engineering around the model is the point: reproducible training, versioned models, tests, and monitoring are what keep machine learning alive in production.

The pipeline · hover a stage

  1. 01 Patient data Age, labs, medications, diagnoses and prior visits come in as raw features.
  2. 02 XGBoost model A gradient-boosted model, tracked in MLflow, scores the 30-day readmission risk.
  3. 03 Explainable risk Each score ships with a SHAP breakdown of what pushed the risk up or down.
  4. 04 Live dashboard Clinicians see the result, and the system watches its own latency and drift.
In production

It watches itself.

Once deployed, the service tracks its own request latency and checks for data drift, so the team knows when the model needs attention. The line below illustrates the rolling-latency view from monitoring.

API latency · rolling (ms)

Next project Reinforcement Learning Bot
Get in touchEmail me anytime