proposing a new method based on LSTM neural network for anomaly detection in ECG time series data
Subject Areas : electrical and computer engineering
N. Ashrafi-Payaman
1
*
,
B. Mazaheri
2
1 - Engineering School, Kharazmi University, Tehran, Iran
2 - Dept. of Elec. and Comp. Eng., Faculty of Engineering, Kharazmi University, Tehran, Iran
Keywords: anomaly detection, Long Short-Term Memory, ٍژۀ,
Abstract :
In this study, a novel method for detecting abnormalities in electrocardiogram (ECG) signals is presented, which is based on deep learning and LSTM neural networks. In this method, first, ECG signals received from the MIT-BIH dataset are preprocessed. Preprocessing includes noise removal, normalization, and segmentation of the signals. Then, key features from each period of cardiac electrical activity, such as P, Q, R, S, T waves and the time intervals between them, are extracted. Subsequently, these features are given as input to the LSTM neural network so that it can learn the temporal dependencies between them. The results show that the proposed model has been able to distinguish normal and abnormal rhythms with high accuracy. This method can be used in medical applications and real-time monitoring of heart health. The proposed model is able to identify 19 arrhythmia classes with 97.33% accuracy using only 9 features and an LSTM model. While other methods using 60 features and more complex models have been less accurate.
[1] British Heart Foundation Health Analytics Team, Global Cardiovascular Disease Factsheet, British Heart Foundation, Jan. 2026.
[2] U. Naeem, et al., "Global burden of cardiovascular disease: What should be expected in the next 25 years?" Current Cardiology Reports, vol. 28, no. 1, Article ID: 41826546, Mar. 2026.
[3] S. Buzby "Heart disease remains leading cause of death, despite declining overall mortality," Healio, 21 Jan. 2026.
[4] S. Antipolis "Avoidable inequalities remain in cardiovascular disease burden and care," European Society of Cardiology, 19 May 2026.
[5] N. Khan and M. N. Imtiaz, Pan-Tompkins++: A Robust Approach to Detect R-peaks in ECG Signals, arXiv preprint, arXiv:2211.03171, Nov. 2022.
[6] J. Hampton and D. Adlam, The ECG Made Easy E-Book, 10th ed. Amsterdam, The Netherlands: Elsevier Health Sciences, 2024.
[7] A. Darmawahyuni, et al., "An improved electrocardiogram arrhythmia classification performance with feature optimization," BMC Medical Informatics and Decision Making, vol. 24, no. 1, Article ID: 412, 2024.
[8] T. Chen, H. Zhang, and J. Wang, "ECG arrhythmia classification using random forest with improved feature selection," Biomedical Signal Processing and Control, vol. 82, Article ID: 104537, 2023.
[9] C. Zhang, et al., "A low-power ECG processor ASIC based on an artificial neural network for arrhythmia detection," Applied Sciences, vol. 13, no. 17, Article ID: 9591, 2023.
[10] S. L. Kailan, W. H. M. Kurdi, A. H. Najim, and M. N. Kadhim, "Efficient ECG classification based on machine learning and feature selection algorithm for IoT-5G enabled health monitoring systems," International Journal of Intelligent Engineering & Systems, vol. 18, no. 1, pp. 1187-1199, 2025.
[11] M. Hassaballah, Y. M. Wazery, I. E. Ibrahim, and A. Farag, "ECG heartbeat classification using machine learning and metaheuristic optimization for smart healthcare systems," Bioengineering, vol. 10, no. 4, Article ID: 429, 2023.
[12] S. Hochreiter and J. Schmidhuber, "Long short-term memory,” Neural Computation, vol. 9, no. 8, pp. 1735-1780, 1997.
[13] I. Goodfellow, Y. Bengio, and A. Courville, Deep Learning, Cambridge, MA, USA: MIT Press, 2016.
[14] Y. N. Wang, G. Zhou, and C. Yang, "Interpatient heartbeat classification using modified residual attention network with two-phase training and assistant decision," IEEE Trans. on Instrumentation and Measurement, vol. 72, pp. 1-15, 2022.
[15] M. Khazaei and N. Ashrafi-Payaman, "An unsupervised anomaly detection model for weighted heterogeneous graph," Journal of Artificial Intelligence and Data Mining, vol. 11, no. 2, pp. 237-245, 2023.
[16] S. Savalia and V. Emamian, "Cardiac arrhythmia classification by multi-layer perceptron and convolution neural networks," Bioengineering, vol. 5, no. 2, Article ID: 35, 2018.
[17] A. Petrovic, et al., "Anomaly detection in electrocardiogram signals using metaheuristic optimized time-series classification with attention incorporated models," International Journal of Hybrid Intelligent Systems, vol. 20, no. 2, pp. 159-183, 2024.
[18] M. Thill, W. Konen, H. Wang, and T. Bäck, "Temporal convolutional autoencoder for unsupervised anomaly detection in time series," Applied Soft Computing, vol. 112, Article ID: 107751, 2021.
[19] H. Li and P. Boulanger, "Structural anomalies detection from electrocardiogram (ECG) with spectrogram and handcrafted features," Sensors, vol. 22, no. 7, Article ID: 2467, 2022.
[20] E. Šabić, D. Keeley, B. Henderson, and S. Nannemann, "Healthcare and anomaly detection: Using machine learning to predict anomalies in heart rate data," AI & Society, vol. 36, no. 1, pp. 149-158, 2021.
[21] S. M. H. Irid, D. Moussaoui, M. Hadjila, and O. Azzoug, "Classification of ECG signals based on MIT-BIH dataset using Bi-LSTM model for assisting cardiologists diagnosis," Traitement du Signal, vol. 41, no. 6, pp. 3245-3253, Dec. 2024.
[22] G. Karthik, T. Muppala, V. Chowdary, and S. Jayan, "ECG signal classification and anomaly detection using LSTM and HMM models," in Proc. 11th Int. Conf. on Advances in Computing and Communications, 6 pp., Kochi, India, 6-8 Nov. 2024.
[23] M. E. Ait Bourkha, A. Hatim, D. Nasir, and S. El Beid, "Optimized wavelet scattering network and CNN for ECG heartbeat classification from MIT-BIH arrhythmia database," International Journal of Advanced Computer Science and Applications, vol. 16, no. 2, Article ID: 116, 2025.
[24] M. Alghieth, "DeepECG-Net: A hybrid transformer-based deep learning model for real-time ECG anomaly detection," Scientific Reports, vol. 15, no. 1, Article ID: 20714, 2025.
[25] H. M. Rai, J. Yoo, and S. Dashkevych, "GAN-SkipNet: A solution for data imbalance in cardiac arrhythmia detection using electrocardiogram signals from a benchmark dataset," Mathematics, vol. 12, no. 17, Article ID: 2693, 2024.
[26] A. Rajput, N. R. Patel, R. S. Bhati, A. P. Singh, and H. Fatima, "Anomaly detection in ECG using deep learning," in Proc. 11th Int. Conf. on Computing for Sustainable Global Development, pp. 76-82, New Delhi, India, 28 Feb.-1 Mar. 2024.
[27] S. Hiriyannaiah, S. G. M., K. M. H. M., and K. G. Srinivasa, "A comparative study and analysis of LSTM deep neural networks for heartbeats classification," Health and Technology, vol. 11, no. 3, pp. 663-671, 2021.
[28] S. Sahoo, M. Dash, S. Behera, and S. Sabut, “Machine learning approach to detect cardiac arrhythmias in ECG signals: A survey," Innovation and Research in BioMedical engineering, vol. 41, pp. 185-194, Aug. 2020.
[29] V. Nair and G. E. Hinton, "Rectified linear units improve restricted Boltzmann machines," in Proc. 27th Int. Conf. Machine Learning, pp. 807-814, 21-24 Jun. 2010.
[30] J. S. Bridle, "Training stochastic model recognition algorithms as networks can lead to maximum mutual information estimation of parameters," Advances in Neural Information Processing Systems, vol. 2, pp. 211-217, Denver, CO, USA, 27-30 Nov. 1989.
[31] G. B. Moody and R. G. Mark, MIT-BIH Arrhythmia Database, PhysioNet, 2005. [Online]. Available: https://physionet.org/content/mitdb/1.0.0
[32] D. P. Kingma and J. Ba, Adam: A Method for Stochastic Optimization, arXiv preprint, arXiv:1412.6980, 2014.
[33] D. M. Powers, Evaluation: From Precision, Recall and F-measure to ROC, Informedness, Mmarkedness and Correlation, arXiv preprint, arXiv:2010.16061, 2020.
[34] Y. Sasaki, The Truth of the F-Measure, Teach Tutor Materials, 5 pp., 26 Oct. 2007. Available: https://people.cs.pitt.edu/~litman/courses/cs1671s20/F-measure-YS-26Oct07.pdf [Accessed: Oct. 25, 2026].
[35] J. Brabec, T. Komárek, V. Franc, and L. Machlica, "On model evaluation under non-constant class imbalance," in Proc. Int. Conf. on Computational Science, pp. 74-87, Amsterdam, The Netherlands, 3-5 Jun. 2020.
[36] W. Siblini, J. Fréry, L. He-Guelton, F. Oblé, and Y. Q. Wang, "Master your metrics with calibration," in Proc. 18th Int. Symp. on Advances in Intelligent Data Analysis, pp. 457-469, Konstanz, Germany, 27-29 Apr. 2020
[37] D. Chicco and G. Jurman, "The advantages of the Matthews correlation coefficient (MCC) over F1 score and accuracy in binary classification evaluation," BMC Genomics, vol. 21, no. 1, Article ID: 6, 2020.
[38] C. Qiu, H. Li, C. Qi, and B. Li, "Enhancing ECG classification with continuous wavelet transform and multi-branch transformer," Heliyon, vol. 10, no. 5, Article ID: e26147, Mar. 2024.
[39] J. Park, K. Lee, N. Park, S. C. You, and J. Ko, "Self-Attention LSTM-FCN model for arrhythmia classification and uncertainty assessment," Artificial Intelligence in Medicine, vol. 142, Article ID: 102570, Aug. 2023.