SQL (Oracle), Python (PyTorch, NumPy, Pandas, Matplotlib, Seaborn)
Deep learning model to predict delirium in hospitalized patients using time-series electronic health records. Implemented various ML approaches including BiRNN and Dual Self-Attention networks.
This project was part of my internship at HUG and is ongoing. The main challenge: delirium is often not coded, leading to missed revenue for the hospital. A tool that predicts delirium at patient entry could enable earlier intervention and better planning.
I began by reviewing existing research. Many papers address this issue; one notable example is
“An interpretable deep learning model for time-series electronic health records: Case study of delirium prediction in critical care” (Sheikhalishahi et al.), which uses deep learning on public ICU datasets (MIMIC, eICU).
Data Analysis & Preprocessing
Queried and filtered data for delirium patients using SQL
Handled missing data, outliers, and filled gaps
Excluded the last hours before delirium onset to avoid biasing the model with signals that only appear right before the event
Time Series Processing*
Binning: Aggregate measurements into hourly bins
Sequencing: Organize data into time sequences per patient
Window Selection: Create prediction windows for forecasting
Model Selection Tested several models, each with unique strengths:
Logistic Regression: Interpretable, fast, but limited for complex patterns
XGBoost: Handles non-linearities, robust to missing data, but less effective for sequences
BiRNN (LSTM): Captures long-term dependencies, but needs more data and is less interpretable
DSA (Dual Self-Attention): Focuses on both time and features, powerful but complex
Model Training
Padding: Ensure all sequences are the same length
Tensor Conversion: Transform data for PyTorch
DataLoaders: Efficient batching for training
Handling Class Imbalance
Delirium is rare, so we used:
Class weights in the loss function
Weighted sampling
Specialized loss functions
Training Process
Forward pass → Loss calculation → Backpropagation → Parameter update
Model Evaluation
Used cross-validation with stratified K-folds to ensure balanced splits. Key metrics:
AUC (Area Under ROC Curve)
Specificity at 90% Sensitivity
PPV (Positive Predictive Value)
MCC (Matthews Correlation Coefficient)
Visualization
ROC curves, learning curves, feature importance plots, confusion matrices
Hyperparameter Tuning
Grid search, random search, and Bayesian optimization (Optuna)
Interpretability
Crucial for clinical trust:
Guided Backpropagation, Integrated Gradients, Shapley Value Sampling
SHAP summary plots and sorted feature importance help clinicians understand predictions
No Github or Links - Confidential :)