Skip to content

Commit fe30768

Browse files
committed
Update
1 parent 4cddd61 commit fe30768

7 files changed

Lines changed: 39 additions & 1 deletion

File tree

.DS_Store

0 Bytes
Binary file not shown.

README.md

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,43 @@
1010

1111
This project implements a dual-architecture early warning system comparing gradient-boosted decision trees (LightGBM) against temporal convolutional networks (TCN) for predicting ICU patient deterioration, across three risk horizons (maximum risk atained, average sustained risk, % time spent in high risk). Built on MIMIC-IV Clinical Demo v2.2 dataset (100 patients), the system processes 171 temporal features across 24-hour windows and 40 aggregated patient-level features, to support continuous monitoring and escalation decisions.
1212

13+
```text
14+
Raw EHR Data
15+
(vitals, observations, lab results)
16+
17+
┌─────────────────────────┴─────────────────────────┐
18+
│ │
19+
▼ ▼
20+
21+
Patient-Level Feature Engineering Timestamp-Level Feature Engineering
22+
(make_patient_features.py → news2_features_patient.csv) (make_timestamp_features.py → news2_features_timestamp.csv)
23+
- Median, mean, min, max per vital - Missingness flags
24+
- Imputation using patient-specific median - Last Observation Carried Forward (LOCF)
25+
- % Missingness per vital - Carried-forward flags
26+
- Encode risk labels and summary target stats - Rolling windows 1/4/24h (mean, min, max, std, slope, AUC)
27+
• max_risk - Time since last observation (staleness)
28+
• median_risk - Encode risk labels
29+
• pct_time_high
30+
31+
▼ ▼
32+
33+
LightGBM Model (Classical ML) Temporal Convolutional Network (TCN)
34+
- One fixed-length vector per patient - Full multivariate sequence per patient per timestamp
35+
- Fast, interpretable (SHAP) - Learns trends, slopes, sub-threshold drift
36+
- Strong baseline for tabular data - Handles irregular sampling & long-range context
37+
- Cannot model sequences - Requires sequential data
38+
```
39+
1340
The hybrid approach reveals complementary strengths: LightGBM achieves superior calibration and regression fidelity (68% Brier reduction, +17% AUC, +44% R²) for sustained risk assessment, while TCN demonstrates stronger acute event discrimination (+9.3% AUC, superior sensitivity) for detecting rapid deterioration.
1441

1542
The complete pipeline includes NHS-validated NEWS2 preprocessing with CO₂ retainer logic, GCS mapping, and supplemental O₂ protocols; extensive evaluation metrics and model-specific interpretability methods for clinical validation (SHAP for LightGBM, absolute gradient×input saliency for TCN); and a deployment-ready dual inference system (batch and per-patient) for end-to-end usability.
1643

44+
| Target | Best Model | Key Metric(s) | Notes |
45+
|-----------------|------------|--------------------------|-------|
46+
| Maximum Risk | TCN | ROC AUC: 0.923 | Strong acute detection, high sensitivity |
47+
| Median Risk | LightGBM | ROC AUC: 0.972, Brier: 0.065 | Superior sustained risk calibration |
48+
| Percentage Time High | LightGBM | R²: 0.793 | Better regression fidelity for high-risk exposure |
49+
1750
**Key Contributions:**
1851
- Clinical validity pipeline with robust NEWS2 computation
1952
- Dual feature engineering (patient-level vs timestamp) for both classical and deep learning models
@@ -76,6 +109,11 @@ NEWS2 scoring bands map directly to clinical monitoring frequency and escalation
76109
### Why Machine Learning?
77110
ICU deterioration is complex and often subtle, involving multivariate temporal patterns that standard threshold-based systems cannot fully capture. ML models allow us to go beyond static scoring by predicting summary outcomes derived from NEWS2 clinical-risk categories.
78111

112+
| Model | Type | Input Features | Modelling Type | Strengths | Weaknesses | Interpretability |
113+
|-------|------|----------------|------------------|-----------|------------|----------------|
114+
| LightGBM | Gradient-Boosted Decision Tree | Aggregated patient-level | Static | Fast, interpretable, good calibration | Cannot capture sequential dynamics | SHAP |
115+
| TCN | Temporal Convolutional Network | Timestamp-level sequential | Temporal | Captures temporal trends, slopes, variability | Requires high-resolution data, slower to train | Saliency (|grad×input|) |
116+
79117
#### LightGBM (classical, non-temporal ML)
80118
- LightGBM, a gradient-boosted decision tree (GBDT) algorithm, provides a strong baseline for tabular clinical data
81119
- Captures nonlinear interactions between vital signs
@@ -89,7 +127,7 @@ ICU deterioration is complex and often subtle, involving multivariate temporal p
89127
- Robust to irregular sampling
90128
- Potentially detects subtle deterioration earlier than threshold-based approaches
91129

92-
#### Why compare both
130+
#### Why compare both?
93131
- LightGBM provides a robust classical-ML baseline for tabular clinical data.
94132
- TCN evaluates whether temporal modelling yields measurable gains by capturing sequential patterns and slopes in vital signs.
95133
- This comparison reflects realistic deployment: classical ML may suffice for lower-frequency ward data, whereas temporal models exploit high-resolution ICU monitoring to detect early deterioration.

images/.DS_Store

6 KB
Binary file not shown.
File renamed without changes.

images/news2_chart.png

60.6 KB
Loading
File renamed without changes.

0 commit comments

Comments
 (0)