Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Emergency Department Demand Forecasting with LSTM

A reproducible deep-learning project for daily and true month-ahead emergency department patient-arrival forecasting using Long Short-Term Memory networks.

The project progresses from one-step forecasting to a monthly-total-aware direct multi-horizon residual LSTM that predicts a complete future month without recursively feeding predictions back into the network.

Final 2023 month-ahead result

Metric Seasonal-7 Baseline Total-Aware Direct LSTM Improvement
MAE 1061.00 901.77 15.01%
RMSE 1260.34 1007.04 20.10%
MAPE 13.87% 11.38%
WAPE 13.11% 11.14% 15.01%
0.1961 0.4867 +0.2906

The final test-set mean signed error was +464.15 visits/month, indicating residual underprediction. No post-hoc test-set correction was applied.

Daily forecasting result

Metric Persistence t-1 Residual LSTM Improvement
MAE 28.490 22.032 22.67%
RMSE 36.567 28.278 22.67%
MAPE 10.80% 8.53%
WAPE 10.71% 8.28% 22.67%
0.6262 0.7765 +0.1503

Temporal design

  • Training: 2019–2021
  • Validation / model selection: 2022
  • Final untouched test: 2023

No random time-series splitting was used.

Final model

  • Historical context: 56 days
  • Historical features: 9
  • Forecast horizon: 31 days
  • Known future calendar features: 4
  • Forecasting strategy: direct multi-horizon
  • Recursive feedback: no
  • Residual baseline: previous 7-day seasonal pattern
  • Monthly-total-aware loss weight: 0.35

Input features

Historical sequence:

  1. standardized patient visits
  2. 7-day rolling mean
  3. 14-day rolling mean
  4. 28-day rolling mean
  5. 7-day rolling standard deviation
  6. day-of-week sine
  7. day-of-week cosine
  8. day-of-year sine
  9. day-of-year cosine

Known future calendar:

  1. day-of-week sine
  2. day-of-week cosine
  3. day-of-year sine
  4. day-of-year cosine

Residual formulation

Predicted demand = Seasonal-7 baseline + LSTM residual correction

Monthly-total-aware objective

Loss = Daily Huber Loss + λ × Monthly Total Loss

with λ = 0.35.

Repository structure

LSTM_Graphs/
├── README.md
├── CITATION.cff
├── requirements.txt
├── .gitignore
├── data/
├── notebooks/
├── src/
├── models/
├── results/
│   ├── metrics/
│   └── predictions/
├── figures/
│   ├── pdf/
│   ├── svg/
│   └── png/
├── tables/
├── docs/
└── kaggle_outputs/

Data

The original source dataset is intentionally not stored in this public repository.

Generated artifacts, aggregated predictions, trained models, metrics, figures, notebooks, and scripts are included where available.

Environment

  • Python 3.x
  • TensorFlow 2.19
  • NumPy
  • pandas
  • scikit-learn
  • matplotlib
  • openpyxl
  • tqdm

Install dependencies:

pip install -r requirements.txt

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages