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.
| 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% |
| R² | 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.
| 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% |
| R² | 0.6262 | 0.7765 | +0.1503 |
- Training: 2019–2021
- Validation / model selection: 2022
- Final untouched test: 2023
No random time-series splitting was used.
- 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
Historical sequence:
- standardized patient visits
- 7-day rolling mean
- 14-day rolling mean
- 28-day rolling mean
- 7-day rolling standard deviation
- day-of-week sine
- day-of-week cosine
- day-of-year sine
- day-of-year cosine
Known future calendar:
- day-of-week sine
- day-of-week cosine
- day-of-year sine
- day-of-year cosine
Predicted demand = Seasonal-7 baseline + LSTM residual correction
Loss = Daily Huber Loss + λ × Monthly Total Loss
with λ = 0.35.
LSTM_Graphs/
├── README.md
├── CITATION.cff
├── requirements.txt
├── .gitignore
├── data/
├── notebooks/
├── src/
├── models/
├── results/
│ ├── metrics/
│ └── predictions/
├── figures/
│ ├── pdf/
│ ├── svg/
│ └── png/
├── tables/
├── docs/
└── kaggle_outputs/
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.
- Python 3.x
- TensorFlow 2.19
- NumPy
- pandas
- scikit-learn
- matplotlib
- openpyxl
- tqdm
Install dependencies:
pip install -r requirements.txt