← Back![]()
Abnormal ECG detection with RNN and LSTM
Controlled Conv1D–SimpleRNN vs Conv1D–LSTM comparison with record-level splits and MLflow
Problem
Distinguish normal sinus rhythm from abnormal ECG (16 grouped categories) while avoiding leakage across records.
Data
ECG signals (1000 fragments), Kaggle: 1,000 ten-second fragments, 17 classes, 45 MIT-BIH records.
Methods
- 0.5–40 Hz band-pass filter, 360→180 Hz resampling and per-fragment z-score
- Record-level split with StratifiedGroupKFold (≈64/16/20)
- Shared Conv1D extractor + SimpleRNN vs LSTM
- Class weights from training data only
- Threshold tuned on validation (Macro F1); test opened once
- Experiment tracking with MLflow
Results
- SimpleRNN won on validation (52.62% vs 49.16% ROC-AUC for the LSTM); the more complex LSTM did not generalise better with 45 records.
- On test (201 fragments) the model was not satisfactory: 72.03% sensitivity, 18.97% specificity, 45.50% balanced accuracy and 56.72% accuracy, below the 71.70% of predicting everything as abnormal. Reported as is.
Gallery
Tools
PythonTensorFlow / KerasSciPyscikit-learnMLflowDatabricks