This repository provides a modular, reproducible benchmark for Early Sepsis Prediction from Non-Invasive Wearable Vital Signs using causal deep learning and geometric rough path theory on the full PhysioNet Computing in Cardiology Challenge 2019 cohort (40,336 ICU stays across MIMIC-III and Emory eICU).
Sepsis is a life-threatening organ dysfunction caused by a dysregulated host response to infection. In intensive care units (ICUs), clinical evidence shows that in-hospital mortality increases by 7.6% for every hour of delayed antimicrobial therapy following onset.
However, existing machine learning pipelines suffer from three pervasive flaws in real-world bedside deployment:
-
Invasive & Latent Laboratory Dependency: Traditional models rely heavily on invasive arterial blood draws and laboratory tests (e.g., Lactate, Bilirubin, Platelets, Creatinine) which exhibit collection latencies of 4 to 24 hours. This work restricts inputs strictly to 6 non-invasive wearable vital signs (
HR,O2Sat,Temp,Resp,SBP,DBP), enabling continuous non-invasive bedside and telemetry monitoring. -
Double-Buffering & The "-6 Hour" Target Distortion: In PhysioNet 2019, raw challenge labels already start 6 hours before clinical onset ($\text{SepsisLabel}t = 1 \iff t \ge t{sepsis} - 6$). Prior literature erroneously shifted this raw label by
$-H$ , inadvertently shifting the prediction target up to$t_{sepsis} - (H + 6)$ hours before onset (e.g. attempting to predict 18h prior while assuming 12h). -
Severe Look-Ahead Data Leakage: Pervasive use of bidirectional backward-fill (
bfill), full-stay mean imputation, and dataset-wide feature scaling leaks future physiological deterioration into earlier timestamps, inflating reported offline AUROC while collapsing in true clinical deployment.
To eliminate the 6-hour label distortion, we mathematically reconstruct the true clinical onset time
where
We derive 4 point-in-time hemodynamic coupling channels prior to feature standardization:
Combined with causal rolling statistics (means and standard deviations over 3h and 6h windows) and causal 1h derivatives (
While 1D dilated convolutions model univariate temporal rates of change, they are blind to the non-linear geometric circulation between paired physiological variables. For a multi-dimensional trajectory
Geometrically,
- When heart rate accelerates while blood pressure decompensates, the trajectory circulates in a clockwise loop (
$A^{\text{HR}, \text{SBP}} > 0$ ). - When respiratory rate surges ahead of oxygen desaturation, the loop area quantifies respiratory compensation latency.
The multi-stream HybridSepsisModel fuses dilated causal TCN representations with exact GPU-computed Level-2 Lévy areas in
E:\AI\
├── configs/
│ └── default_config.yaml # Centralized hyperparameters, seeds, and dilation schedules
├── data/
│ └── cleaned_sepsis_dataset.csv # Full PhysioNet 2019 dataset (40,336 patients, 66.3 MB)
├── figures/ # High-resolution benchmark figures (300 DPI PNG + Vector PDF)
│ ├── fig1_roc_pr_comparison.png # Test ROC and Precision-Recall curves
│ ├── fig2_horizon_utility_curve.png # Multi-horizon utility and AUROC error bands
│ ├── fig3_levy_area_importance.png # Learned physiological Lévy area feature importance
│ └── fig4_patient_trajectory_case_study.png # Bedside ICU early alarm trajectory
├── results/
│ ├── full_cohort_ablation_results.csv # Master Table 1 (4 models, H=6h & H=12h)
│ └── full_cohort_horizon_sweep.csv # Master Table 2 (hybrid_signature vs. tcn: 4h to 18h)
├── src/
│ ├── data/
│ │ ├── preprocess.py # Stateful causal ffill + train median fallback + standard scaling
│ │ ├── features.py # Hemodynamic coupling (SI, PP, eMAP, ROX) + rolling stats + derivatives
│ │ └── dataset.py # Fast memory-indexed sliding window dataset (117k samples/sec)
│ ├── models/
│ │ ├── tcn.py # MultiTCN & TCNWithAttention (k=3, dilations [1,2,4,8], RF=29h)
│ │ └── hybrids.py # TCNLSTMHybrid & Dual-Stream HybridSepsisModel (Path Signatures)
│ └── utils/
│ ├── losses.py # Mathematically calibrated alpha-balanced Focal Loss
│ ├── metrics.py # Official PhysioNet Utility (U_norm), Lead-Time, 95% Bootstrap CIs
│ └── seed.py # Complete deterministic random seeding
├── train_pipeline.py # Unified CLI entry point for full-cohort training
├── evaluate_pipeline.py # Unified held-out Test evaluation with 200 patient bootstrap CIs
├── run_full_cohort_benchmark.py # Master runner executing the full benchmark experiment matrix
├── generate_paper_figures.py # Standalone figure generation script
├── requirements.txt # Pinned dependencies
└── README.md
All models are trained under strict 70/15/15 patient-level disjoint stratification (28,235 train / 6,050 validation / 6,051 test patients). Thresholds
Table 1: Architecture Comparison ($H = 6\text{h}$ and $H = 12\text{h}$ , Sequence Length $= 14\text{h}$ )
| Model Architecture | Horizon | Test AUROC [95% CI] | Test AUPRC [95% CI] | Optimal Threshold |
Test |
Sensitivity | Specificity | Mean Lead Time | False Alarms / 100h | PhysioNet Utility ( |
|---|---|---|---|---|---|---|---|---|---|---|
tcn |
6h | 0.7365 [0.7124 - 0.7585] | 0.0662 [0.0545 - 0.0784] | 0.68 | 0.1254 | 21.07% | 95.67% | 38.82h | 3.59 | +0.1083 [+0.0862 - +0.1317] |
tcn_attention |
6h | 0.7147 [0.6903 - 0.7405] | 0.0548 [0.0457 - 0.0655] | 0.68 | 0.1100 | 28.98% | 91.98% | 34.82h | 6.74 | +0.1701 [+0.1386 - +0.1996] |
hybrid_tcn_lstm |
6h | 0.7180 [0.6930 - 0.7425] | 0.0550 [0.0456 - 0.0667] | 0.70 | 0.1176 | 18.61% | 96.02% | 36.26h | 3.28 | +0.0989 [+0.0734 - +0.1218] |
hybrid_signature (Ours) |
6h | 0.7244 [0.7020 - 0.7502] | 0.0573 [0.0488 - 0.0686] | 0.68 | 0.1214 | 22.33% | 95.05% | 33.83h | 4.08 | +0.1231 [+0.0942 - +0.1488] |
tcn |
12h | 0.7229 [0.6976 - 0.7484] | 0.0813 [0.0689 - 0.0954] | 0.66 | 0.1445 | 29.92% | 91.12% | 34.92h | 7.49 | +0.1866 [+0.1523 - +0.2207] |
tcn_attention |
12h | 0.7287 [0.7064 - 0.7531] | 0.0774 [0.0672 - 0.0899] | 0.66 | 0.1407 | 40.88% | 86.23% | 36.82h | 11.85 | +0.2501 [+0.2087 - +0.2896] |
hybrid_tcn_lstm |
12h | 0.7257 [0.7000 - 0.7482] | 0.0787 [0.0664 - 0.0930] | 0.68 | 0.1446 | 25.99% | 92.70% | 38.04h | 6.15 | +0.1527 [+0.1210 - +0.1825] |
hybrid_signature (Ours) |
12h | 0.7257 [0.6989 - 0.7509] | 0.0819 [0.0706 - 0.0948] | 0.66 | 0.1517 | 28.53% | 92.26% | 37.09h | 6.57 | +0.1723 [+0.1398 - +0.2029] |
| Horizon ( |
Model | Test AUROC [95% CI] | Test AUPRC [95% CI] | Threshold |
Test |
Specificity | Lead Time | False Alarms / 100h | PhysioNet Utility ( |
|---|---|---|---|---|---|---|---|---|---|
| 4h | tcn |
0.7337 [0.7130 - 0.7580] | 0.0522 [0.0442 - 0.0623] | 0.70 | 0.1159 | 96.75% | 34.30h | 2.65 | +0.0905 [+0.0701 - +0.1136] |
| 4h | hybrid_signature |
0.7350 [0.7125 - 0.7580] | 0.0536 [0.0446 - 0.0648] | 0.68 | 0.1180 | 95.74% | 37.48h | 3.42 | +0.1165 [+0.0924 - +0.1420] |
| 6h | tcn |
0.7365 [0.7124 - 0.7585] | 0.0662 [0.0545 - 0.0784] | 0.68 | 0.1254 | 95.67% | 38.82h | 3.59 | +0.1083 [+0.0862 - +0.1317] |
| 6h | hybrid_signature |
0.7244 [0.7020 - 0.7502] | 0.0573 [0.0488 - 0.0686] | 0.68 | 0.1214 | 95.05% | 33.83h | 4.08 | +0.1231 [+0.0942 - +0.1488] |
| 10h | tcn |
0.7137 [0.6887 - 0.7382] | 0.0685 [0.0587 - 0.0802] | 0.66 | 0.1336 | 93.87% | 35.78h | 5.18 | +0.1378 [+0.1083 - +0.1677] |
| 10h | hybrid_signature |
0.7172 [0.6934 - 0.7398] | 0.0679 [0.0594 - 0.0794] | 0.66 | 0.1356 | 93.35% | 37.20h | 5.63 | +0.1477 [+0.1191 - +0.1767] |
| 12h | tcn |
0.7229 [0.6976 - 0.7484] | 0.0813 [0.0689 - 0.0954] | 0.66 | 0.1445 | 91.12% | 34.92h | 7.49 | +0.1866 [+0.1523 - +0.2207] |
| 12h | hybrid_signature |
0.7257 [0.6989 - 0.7509] | 0.0819 [0.0706 - 0.0948] | 0.66 | 0.1517 | 92.26% | 37.09h | 6.57 | +0.1723 [+0.1398 - +0.2029] |
| 18h | tcn |
0.7173 [0.6950 - 0.7407] | 0.1001 [0.0866 - 0.1160] | 0.66 | 0.1659 | 91.42% | 36.87h | 7.29 | +0.1895 [+0.1591 - +0.2218] |
| 18h | hybrid_signature |
0.7155 [0.6926 - 0.7375] | 0.0995 [0.0864 - 0.1160] | 0.66 | 0.1672 | 91.24% | 37.45h | 7.51 | +0.1875 [+0.1573 - +0.2187] |
The complete suite of benchmark figures is rendered at 300 DPI in figures/ (available in both high-resolution PNG and vector PDF):
| Figure | Description | File Link |
|---|---|---|
| Figure 1 | Side-by-side Test ROC and Precision-Recall Curves ( |
figures/fig1_roc_pr_comparison.png |
| Figure 2 | Multi-Horizon Normalized Utility ( |
figures/fig2_horizon_utility_curve.png |
| Figure 3 | Level-2 Path Signature Signed Lévy Area Attribution ( |
figures/fig3_levy_area_importance.png |
| Figure 4 | ICU Bedside Trajectory Case Study: Real-time Vital Coupling and Early Detection Lead Time | figures/fig4_patient_trajectory_case_study.png |
git clone https://github.com/scarwizz/Sepsis-AI-Project.git
cd Sepsis-AI-Project
pip install -r requirements.txtTrain the champion hybrid_signature model on the full 40,336-patient dataset at Horizon
python train_pipeline.py --model hybrid_signature --horizon 6 --seq_len 14 --epochs 5 --batch_size 256 --max_patients 0Train vanilla tcn at Horizon
python train_pipeline.py --model tcn --horizon 12 --seq_len 14 --epochs 5 --batch_size 256 --max_patients 0Evaluate a checkpoint on the held-out Test set with 200 patient-level bootstrap resamples:
python evaluate_pipeline.py --checkpoint checkpoints/best_hybrid_signature_h6_seq14.pth --output_dir evaluation_outputsTo run the automated multi-architecture ablation, multi-horizon sweep, and figure rendering in one command:
python run_full_cohort_benchmark.pyTo regenerate the benchmark figures independently:
python generate_paper_figures.pyThis repository is open-source under the MIT License.