An intelligent healthcare research project that explores machine learning and deep learning techniques for identifying early signs of clinical deterioration in Intensive Care Unit (ICU) patients. The system uses patient time-series data, vital signs, and laboratory measurements to investigate early prediction of sepsis and other critical events.

The project explores XGBoost, LSTM, GRU, and attention-based deep learning approaches to analyze patient data and support research into early warning systems for critical care.


๐Ÿ“Œ Table of Contents


๐Ÿง  Context

Sepsis is a life-threatening condition that can lead to organ dysfunction and death. Early recognition is particularly important in intensive care, where a patient's condition can deteriorate rapidly.

Traditional clinical monitoring relies on regularly measured vital signs, laboratory tests, and clinical assessment. Machine learning can help researchers investigate patterns in these measurements that may indicate an increased risk of deterioration.

The ICU Early Warning System explores predictive modeling using clinical time-series data. It combines conventional machine learning with recurrent neural network architectures to study patterns associated with sepsis and other critical ICU outcomes.

The project uses the Sepsis-3 framework to define sepsis labels based on suspected infection and an increase in the Sequential Organ Failure Assessment (SOFA) score.

Project goal: Explore data-driven approaches for identifying potential clinical deterioration earlier and evaluating their predictive performance.

๐ŸŽฏ Objectives

  • Analyze clinical time-series data from ICU patients.
  • Explore patterns in vital signs and laboratory measurements.
  • Investigate sepsis prediction using machine learning.
  • Compare gradient-boosting and recurrent neural network approaches.
  • Apply data preprocessing, missing-value handling, and time-series preparation.
  • Evaluate model performance through structured experiments.
  • Develop a research foundation for future ICU early-warning applications.

โœจ Features

  • ๐Ÿฅ ICU Data Analysis: Work with critical-care patient records and clinical measurements.
  • ๐Ÿ“Š Exploratory Data Analysis: Examine patient characteristics, clinical variables, and time-series patterns.
  • ๐Ÿงน Data Preprocessing: Prepare clinical records for machine learning experiments.
  • โฑ๏ธ Time-Series Processing: Organize sequential patient measurements for recurrent neural networks.
  • ๐Ÿค– Machine Learning: Experiment with XGBoost-based predictive models.
  • ๐Ÿง  Deep Learning: Explore recurrent neural network models, including LSTM and GRU architectures.
  • ๐ŸŽฏ Attention-Based Modeling: Investigate attention mechanisms for sequential clinical data.
  • โš™๏ธ Hyperparameter Optimization: Run tuning experiments to explore model configurations.
  • ๐Ÿ“ˆ Visualization: Generate exploratory and model-evaluation plots.
  • ๐Ÿ”ฌ Reproducible Experiments: Organize training and testing through dedicated experiment scripts.

These features describe the repository's research workflow; they do not imply that the project is a validated clinical monitoring or alerting product.

๐Ÿ—ƒ๏ธ Dataset

MIMIC-III Clinical Database

This project uses the MIMIC-III v1.4 critical-care database, which contains de-identified hospital and ICU records.

Dataset source: MIMIC-III on PhysioNet

The database contains clinical information such as:

  • Patient demographics and hospital admissions.
  • ICU admission and discharge information.
  • Vital signs and physiological measurements.
  • Laboratory test results.
  • Medication and microbiology records.
  • Clinical measurements collected over time.

Sepsis Labeling

The project follows a Sepsis-3-based labeling approach. Sepsis labels are derived from the temporal relationship between suspected infection and organ dysfunction.

The labeling process considers:

  1. Suspected infection: The timing of microbiology culture collection and antibiotic treatment.
  2. Organ dysfunction: An increase of at least two points in the SOFA score.
  3. Temporal alignment: The relationship between these events at the hourly level.

Correct labeling depends on the implementation details and the availability and quality of the source records.

Important: The dataset is not included in this repository. Access requires the appropriate PhysioNet credentials, completion of required training, and acceptance of the applicable data-use agreement.

๐Ÿ—๏ธ System Architecture

The research pipeline can be summarized as follows:

MIMIC-III Clinical Database
            |
            v
  Data Extraction and Collection
            |
            v
 Clinical Data Preprocessing
            |
            v
 Missing-Value Handling
 and Time-Series Preparation
            |
            v
   Feature Engineering
            |
            v
       Data Splitting
            |
            +----------------------+
            |                      |
            v                      v
      XGBoost Model          LSTM / GRU Model
            |                      |
            v                      v
   Model Training and Hyperparameter Tuning
            |                      |
            +----------------------+
                       |
                       v
             Model Evaluation
                       |
                       v
       Results and Visualizations

The diagram represents the overall research workflow. Exact processing steps and model configurations depend on the implementation in the source files.

๐Ÿ”ฌ Methodology

1. Clinical Data Collection

The pipeline uses clinical records derived from MIMIC-III. The records provide the measurements and timestamps required to construct patient-level and time-series datasets.

2. Data Preprocessing

Clinical data require preparation before modeling. The project includes preprocessing utilities for collecting records, transforming variables, handling missing values, and preparing model inputs.

3. Missing-Value Handling

Clinical measurements are not always recorded at uniform intervals. Preprocessing includes binning and imputation utilities to handle missing values in time-series data.

The choice of imputation method can affect model performance and must be considered during evaluation.

4. Feature Engineering

Clinical measurements are transformed into model-compatible features.

For XGBoost, time-series variables can be transformed into statistical or structured features. Recurrent neural networks use sequential inputs that preserve temporal information.

5. Model Training

The repository includes separate experiment workflows for gradient boosting and recurrent neural networks.

Hyperparameter tuning is used to investigate candidate model configurations before testing.

6. Model Evaluation

The trained models are evaluated using the available experimental workflow. Results should be interpreted using appropriate classification metrics, class imbalance considerations, and a clearly defined evaluation split.

No numerical performance claims are made here because the actual experiment results must be verified from the generated outputs.

๐Ÿ› ๏ธ Technology Stack

ComponentTechnology
Programming LanguagePython
Data AnalysisPandas, NumPy
Machine LearningXGBoost
Deep LearningLSTM, GRU, attention-based neural networks
Data ProcessingPython preprocessing utilities
ExperimentationCustom training and experiment scripts
Exploratory AnalysisJupyter Notebook
VisualizationMatplotlib and project visualization utilities
DatasetMIMIC-III v1.4
Clinical Labeling FrameworkSepsis-3 / SOFA

The exact package versions and dependencies are defined in requirements.txt.

๐Ÿ“ Project Structure

ICU_Early_Warning_System_Presentation/
โ”‚
โ”œโ”€โ”€ configs/
โ”‚   โ””โ”€โ”€ Experiment configuration files
โ”‚
โ”œโ”€โ”€ models/
โ”‚   โ””โ”€โ”€ hyperparam_opt/
โ”‚       โ””โ”€โ”€ Hyperparameter optimization artifacts
โ”‚
โ”œโ”€โ”€ notebooks/
โ”‚   โ”œโ”€โ”€ files_preview.ipynb
โ”‚   โ”œโ”€โ”€ static_variables_eda.ipynb
โ”‚   โ””โ”€โ”€ time_series_eda.ipynb
โ”‚
โ”œโ”€โ”€ output/
โ”‚   โ””โ”€โ”€ Training, tuning, and evaluation outputs
โ”‚
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ experiments/
โ”‚   โ”‚   โ”œโ”€โ”€ rnn_experiments.py
โ”‚   โ”‚   โ””โ”€โ”€ xgboost_experiments.py
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ models/
โ”‚   โ”‚   โ””โ”€โ”€ Model implementation
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ preprocessing/
โ”‚   โ”‚   โ”œโ”€โ”€ bin_and_impute.py
โ”‚   โ”‚   โ”œโ”€โ”€ collect_records.py
โ”‚   โ”‚   โ”œโ”€โ”€ main_preprocessing.py
โ”‚   โ”‚   โ”œโ”€โ”€ rnn_preprocessing.py
โ”‚   โ”‚   โ”œโ”€โ”€ xgboost_preprocessing.py
โ”‚   โ”‚   โ””โ”€โ”€ util.py
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ visualization/
โ”‚   โ”‚   โ”œโ”€โ”€ plots.py
โ”‚   โ”‚   โ””โ”€โ”€ util.py
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ train_rnn.py
โ”‚   โ””โ”€โ”€ train_xgboost.py
โ”‚
โ”œโ”€โ”€ requirements.txt
โ””โ”€โ”€ README.md

This structure summarizes the repository's documented files. Some generated files and directories may be created during data preparation and experiments.

๐Ÿš€ Installation

Prerequisites

Make sure you have:

  • Python 3.8 or a compatible Python environment for the original project dependencies.
  • Git.
  • PostgreSQL, if you intend to reproduce the original database extraction workflow.
  • Authorized access to the MIMIC-III database.
  • Sufficient storage for the database, processed datasets, and model outputs.

1. Clone the Repository

git clone https://github.com/saranshvaidya0/ICU_Early_Warning_System_Presentation.git

cd ICU_Early_Warning_System_Presentation

2. Create a Virtual Environment

Windows:

python -m venv venv
venv\Scripts\activate

Linux/macOS:

python3 -m venv venv
source venv/bin/activate

3. Install Dependencies

python -m pip install --upgrade pip
pip install -r requirements.txt

Use a compatible Python environment if any dependency is incompatible with your installed Python version.

๐Ÿ“ฅ Dataset Preparation

Step 1: Request Dataset Access

Visit the MIMIC-III PhysioNet page and complete the required credentialing and data-use procedures.

Step 2: Prepare the Database

Follow the official MIMIC Code Repository documentation to build the database using the supported PostgreSQL workflow.

Step 3: Extract and Preprocess Records

Follow the data-extraction workflow documented by the original project and its referenced research resources.

Prepare the processed datasets expected by the preprocessing and experiment scripts.

Note: Raw patient records are not included in this repository. The original research workflow also relies on external data-extraction resources, so installing Python dependencies alone may not be sufficient to reproduce the full pipeline.

โ–ถ๏ธ Running Experiments

The repository provides separate experiment scripts for XGBoost and recurrent neural networks.

XGBoost Experiments

Hyperparameter tuning:

python3 ./src/experiments/xgboost_experiments.py tuning

Testing:

python3 ./src/experiments/xgboost_experiments.py test

Recurrent Neural Network Experiments

Hyperparameter tuning:

python3 ./src/experiments/rnn_experiments.py tuning

Testing:

python3 ./src/experiments/rnn_experiments.py test

Training Entry Points

The repository also contains the following scripts:

python3 ./src/train_xgboost.py
python3 ./src/train_rnn.py

Check the implementation and required arguments before running these training scripts. They may require prepared input datasets, configuration files, and trained or tuned model parameters.

๐Ÿค– Models

1. XGBoost

XGBoost is a gradient-boosting method used to investigate predictive patterns in structured clinical features.

Potential strengths include:

  • Handling structured numerical features.
  • Modeling nonlinear relationships.
  • Supporting feature-importance analysis.
  • Providing a useful comparison against deep learning approaches.

2. LSTM

Long Short-Term Memory networks are recurrent neural networks designed to model dependencies across sequential data.

In an ICU setting, LSTM models can learn temporal patterns in clinical measurements when supplied with appropriately prepared sequences.

3. GRU

Gated Recurrent Units provide an alternative recurrent architecture with a different gating design.

They can be investigated as an alternative to LSTM for learning temporal patterns in patient measurements.

4. Attention Mechanisms

Attention-based approaches can help a model assign different weights to information within a sequence, depending on the architecture and implementation.

Attention weights alone should not be interpreted as definitive clinical explanations.

๐Ÿ“Š Evaluation

A reliable evaluation should consider more than overall accuracy, particularly when critical events are relatively uncommon.

Recommended metrics include:

MetricPurpose
PrecisionMeasures how many positive predictions are correct
Recall / SensitivityMeasures how many actual positive cases are identified
F1-scoreBalances precision and recall
AUROCMeasures ranking performance across classification thresholds
AUPRCEvaluates precision-recall performance, especially with imbalanced classes
Confusion MatrixSummarizes true and false predictions

Evaluation should use an appropriate held-out test set and avoid patient overlap or temporal data leakage between training and testing.

Actual scores should be reported only after verifying the experiment outputs.

โš ๏ธ Limitations

  • Model performance depends on data quality and preprocessing.
  • Missing or irregularly collected clinical measurements can affect predictions.
  • Sepsis labeling depends on the operational definition and timestamp alignment.
  • Imbalanced outcome classes can make accuracy misleading.
  • Performance on MIMIC-III may not generalize to other hospitals or patient populations.
  • The repository does not, by itself, establish real-time hospital monitoring or deployment readiness.
  • Clinical validation, external validation, calibration, and workflow evaluation are necessary before any real-world application.

๐Ÿ”ฎ Future Improvements

Potential areas for improvement include:

  • Add a unified training and evaluation pipeline.
  • Compare LSTM, GRU, XGBoost, and attention-based architectures systematically.
  • Add model calibration and decision-threshold analysis.
  • Improve missing-data handling and temporal feature engineering.
  • Add explainability tools for model predictions.
  • Create a dashboard for exploring research results.
  • Add automated experiment tracking.
  • Introduce patient-level validation and external validation.
  • Add reproducible environment and data-preparation documentation.
  • Evaluate alert frequency and false-alarm trade-offs.
  • Investigate deployment only after appropriate clinical validation.

๐Ÿฉบ Ethical Considerations

This project is intended for educational and research purposes.

  • Patient data must be handled in accordance with the applicable PhysioNet data-use agreement.
  • Do not upload protected patient information to public repositories.
  • Do not commit raw patient records, credentials, or sensitive data.
  • Predictions must not be used as a substitute for professional clinical judgment.
  • Any future clinical deployment requires rigorous validation, privacy safeguards, and appropriate regulatory and institutional review.

Disclaimer: This project is not a certified medical device and must not be used to diagnose, treat, or make emergency-care decisions for real patients.

๐Ÿ™ Acknowledgements

This project acknowledges the contributions of the clinical research and open-source communities.

  • MIMIC-III: PhysioNet
  • MIMIC Code Repository: MIT Laboratory for Computational Physiology
  • Sepsis Prediction Research: Moor et al., Early Recognition of Sepsis with Gaussian Process Temporal Convolutional Networks and Dynamic Time Warping (2019).
  • MIMIC-III Publication: Johnson et al., MIMIC-III, a freely accessible critical care database (2016).

Please consult the original publications and dataset terms when using the associated data or research methods.

๐Ÿ‘จโ€๐Ÿ’ป Author

Saransh Vaidya


โญ If you find this project useful for learning or research, consider starring the repository.

Built for healthcare AI research, machine learning experimentation, and early-warning system development.