You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+35-31Lines changed: 35 additions & 31 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -65,7 +65,7 @@ Although the national standard for deterioration detection, NEWS2 has well-recog
65
65
66
66
##
67
67
### 1.2 Clinical Escalation Context
68
-
### 1.2.1 How NEWS2 Scoring Is Used
68
+
####1.2.1 How NEWS2 Scoring Is Used
69
69
NEWS2 scoring bands map directly to clinical monitoring frequency and escalation actions; these operational consequences define the clinical targets we aim to predict:
@@ -264,22 +264,24 @@ Maintaining both feature sets ensures flexibility and robustness in model select
264
264
### 4.2 Timestamp-Level Features (for TCN)
265
265
**Purpose:** Capture temporal dynamics for sequential modeling
266
266
267
-
#### 4.2.1 Imputation Strategy
267
+
#### 4.2.1 Feature Computation
268
+
269
+
**Imputation Strategy**
268
270
-**Missingness flags:** Binary indicators (1/0) for each vital parameter (value carried forward=1) so models can learn from missing patterns. Before carried-forward so that it is known which values were originally missing.
269
271
-**LOCF (Last Observation Carried Forward) flags:** Propagate previous valid measurement, and create a binary carried-forward flag (binary 1/0).
270
272
271
-
#### 4.2.2 Rolling Window Features (1/4/24h)
273
+
**Rolling Window Features (1/4/24h)**
272
274
-**Mean:** Average value
273
275
-**Min/Max:** Range boundaries
274
276
-**Std**: Variability
275
277
-**Slope:** Linear trend coefficient
276
278
-**AUC (Area Under Curve):** Integral of value over time
277
279
278
-
#### 4.2.3 Other Features
280
+
**Other Features**
279
281
-**Staleness:** Time since last observation (staleness per vital)
-**Training approach:** Each timestep inherits the patient label → TCN maps whole sequence → patient-level prediction.
404
406
405
-
**Why not per-timestep prediction:**
407
+
**Why not per-timestep prediction**
406
408
- True sequence-to-sequence labeling would predict risk per timestep for richer early-warning capability.
407
409
- Challenges: require detailed labels for every timestamp (rare in ICU datasets), per-timestep prediction in a small dataset is prone to overfitting and instability; and evaluation is complex.
408
410
@@ -495,7 +497,7 @@ Maintaining both feature sets ensures flexibility and robustness in model select
495
497
496
498
##
497
499
### 6.3 Hyperparameter Tuning
498
-
### 6.3.1 Tuning Process
500
+
####6.3.1 Tuning Process
499
501
- This is the only Phase 3 component used in later phases (Phase 5 LightGBM evaluation).
500
502
- Tuned the four parameters with the highest impact on stability and generalisation for small tabular datasets:
501
503
- `learning_rate` → controls step size; balances speed vs overfitting.
@@ -564,11 +566,13 @@ Maintaining both feature sets ensures flexibility and robustness in model select
564
566
**Purpose:**
565
567
- Build, configure, and train a causal deep-learning model that captures temporal deterioration patterns beyond what classical ML can learn.
566
568
- Deliver a fully reproducible end-to-end pipeline: data preparation → model design → training → validation → diagnostics → refinement
567
-
**Why This Phase Matters**
569
+
570
+
**Why This Phase Matters:**
568
571
- Classical models (e.g., LightGBM) cannot model temporal dynamics; the TCN extends the system to sequence-level reasoning
569
572
- Initial TCN runs revealed class imbalance and regression skew, requiring corrective steps (pos-weighting, log-transform)
570
573
- This phase demonstrates mature ML workflow: identify issues → diagnose → correct → retrain
571
-
**End Products of Phase 4**
574
+
575
+
**End Products of Phase 4:**
572
576
- Clean model-ready preprocessed data and patient splits
573
577
- Clean padded/masked tensor datasets for sequence modelling
574
578
- Fully defined multi-task causal TCN architecture
@@ -613,24 +617,24 @@ Maintaining both feature sets ensures flexibility and robustness in model select
613
617
- Add `max_risk`, `median_risk`, `pct_time_high` from patient-level data
614
618
2.**Patient-level Stratified Split**
615
619
- Split: Train/validation/test → 70/15/15
616
-
- Stratified by the same binary risk labels used for LightGBM (see Section 6.2) → stratification prevents class imbalance, random state fixed for reproducibility
617
-
- Splitting by patient prevents leakage across sequences
620
+
- Stratified by the same binary risk labels used for LightGBM (see Section 6.2) → stratification prevents class imbalance, random state fixed for reproducibility
621
+
- Splitting by patient prevents leakage across sequences
618
622
3.**Feature Cleaning**
619
-
- Identify all feature columns (exclude IDs and targets), remove unused categorical fields, convert certain labels to binary → 171 timestamp-level feaures
620
-
- Separate continuous (for z-score scaling) vs binary (no scaling needed) features.
623
+
- Identify all feature columns (exclude IDs and targets), remove unused categorical fields, convert certain labels to binary → 171 timestamp-level feaures
624
+
- Separate continuous (for z-score scaling) vs binary (no scaling needed) features.
621
625
4.**Normalisation**
622
626
- Apply z-scoring to continuous variables (categorical features unchanged) on train/val/test splits → ensures features are on comparable scales, preserving trends.
623
-
- Fit `StandardScaler()` on training patients only (avoids information leakage).
627
+
- Fit `StandardScaler()` on training patients only (avoids information leakage).
624
628
5.**Sequence Construction**
625
-
- Group rows per patient.
626
-
- Convert each patient to (timesteps × features) 2D NumPy arrays.
629
+
- Group rows per patient.
630
+
- Convert each patient to (timesteps × features) 2D NumPy arrays.
627
631
6.**Sequence Padding/Truncation and Masking**
628
-
- Use fixed length 96 hours → `MAX_SEQ_LEN = 96` for uniform input sizes
629
-
- Short sequences → zero-pad; long sequences → truncate.
630
-
- Masks mark real (1) vs padded (0) timesteps for loss computation.
632
+
- Use fixed length 96 hours → `MAX_SEQ_LEN = 96` for uniform input sizes
633
+
- Short sequences → zero-pad; long sequences → truncate.
634
+
- Masks mark real (1) vs padded (0) timesteps for loss computation.
631
635
7.**Stack Sequences + Mask tensors For Each Split (train/val/test):**
0 commit comments