proposing a new method based on LSTM neural network for anomaly detection in ECG time series data
Nosratali Ashrafi-Payaman
1
(
)
Behrad Mazaheri
2
(
Department of Electrical and Computer Enginering, Faculty of Engineering, Kharazmi University
)
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] Hochreiter, S., & Schmidhuber, J. (1997). Long short-term memory. Neural computation, 9(8), 1735-1780.
[2] Berkaya, S. K., Uysal, A. K., Gunal, E. S., Ergin, S., Gunal, S., & Gulmezoglu, M. B. (2018). A survey on ECG analysis. Biomedical Signal Processing and Control, 43, 216-235.
[3] Clifford, G. D., & Azuaje, F. (2006). Advanced methods and tools for ECG data analysis (Vol. 10). P. McSharry (Ed.). Boston: Artech house.
[4] Khan, N., & Imtiaz, M. N. (2022). Pan-Tompkins++: A Robust Approach to Detect R-peaks in ECG Signals. arXiv preprint arXiv:2211.03171.
[5] Darmawahyuni, A., Nurmaini, S., Tutuko, B., Rachmatullah, M. N., Firdaus, F., Sapitri, A. I., ... & Perwira, M. I. (2024). An improved electrocardiogram arrhythmia classification performance with feature optimization. BMC Medical Informatics and Decision Making, 24(1), 412.
[6] Hampton, J., Hampton, J., & Adlam, D. (2024). The ecg made easy e-book: The ecg made easy e-book. Elsevier Health Sciences.
[7] Chen, T., Zhang, H., & Wang, J. (2023). ECG arrhythmia classification using random forest with improved feature selection. Biomedical Signal Processing and Control, 82, 104537. https://doi.org/10.1016/j.bspc.2023.104537
[8] Zhang, C., Chang, J., Guan, Y., Li, Q., Wang, X. A., & Zhang, X. (2023). A low-power ecg processor asic based on an artificial neural network for arrhythmia detection. Applied Sciences, 13(17), 9591.
[9] Kailan, S. L., Madhloom Kurdi, W. H., Najim, A. H., & Kadhim, M. N. (2025). Efficient ECG Classification Based on Machine Learning and Feature Selection Algorithm for IoT-5G Enabled Health Monitoring Systems. International Journal of Intelligent Engineering & Systems, 18(1).
[10] Hassaballah, M., Wazery, Y. M., Ibrahim, I. E., & Farag, A. (2023). Ecg heartbeat classification using machine learning and metaheuristic optimization for smart healthcare systems. Bioengineering, 10(4), 429.
[11] Goodfellow, I., Bengio, Y., Courville, A., & Bengio, Y. (2016). Deep learning (Vol. 1, No. 2). Cambridge: MIT press.
[12] Wang, Y. N., Zhou, G., & Yang, C. (2022). Interpatient heartbeat classification using modified residual attention network with two-phase training and assistant decision. IEEE Transactions on Instrumentation and Measurement, 72, 1-15.
[13] Khazaei, M., & Ashrafi-Payaman, N. (2023). An unsupervised anomaly detection model for weighted heterogeneous graph. Journal of AI and Data Mining, 11(2), 237-245.
[14] Savalia, S., & Emamian, V. (2018). Cardiac arrhythmia classification by multi-layer perceptron and convolution neural networks. Bioengineering, 5(2), 35.
[15] Petrovic, A., Jovanovic, L., Venkatachalam, K., Zivkovic, M., Bacanin, N., & Budimirovic, N. (2024). Anomaly detection in electrocardiogram signals using metaheuristic optimized time-series classification with attention incorporated models. International Journal of Hybrid Intelligent Systems, 20(2), 159-183.
[16] Thill, M., Konen, W., Wang, H., & Bäck, T. (2021). Temporal convolutional autoencoder for unsupervised anomaly detection in time series. Applied Soft Computing, 112, 107751.
[17] Li, H., & Boulanger, P. (2022). Structural anomalies detection from electrocardiogram (ECG) with spectrogram and handcrafted features. Sensors, 22(7), 2467.
[18] Šabić, E., Keeley, D., Henderson, B., & Nannemann, S. (2021). Healthcare and anomaly detection: using machine learning to predict anomalies in heart rate data. Ai & Society, 36(1), 149-158.
[19] Irid, S. M. H., Moussaoui, D., Hadjila, M., & Azzoug, O. (2024). Classification of ecg signals based on mit-bih dataset using bi-lstm model for assisting cardiologists diagnosis. Traitement du Signal, 41(6), 3245.
[20] Rajput, A., Patel, N. R., Bhati, R. S., Singh, A. P., & Fatima, H. (2024, February). Anomaly Detection in ECG using Deep Learning. In 2024 11th International Conference on Computing for Sustainable Global Development (INDIACom) (pp. 76-82). IEEE. Irid, S. M. H., Moussaoui, D., Hadjila, M., & Azzoug,
[21] AIT BOURKHA, M. E., HATIM, A., NASIR, D., & EL BEID, S. (2025). Optimized wavelet scattering network and cnn for ecg heartbeat classification from mit–bih arrhythmia database. International Journal of Advanced Computer Science & Applications, 16(2).
[22] Alghieth, M. (2025). DeepECG-Net: a hybrid transformer-based deep learning model for real-time ECG anomaly detection. Scientific Reports, 15(1), 20714.
[23] Rai, H. M., Yoo, J., & Dashkevych, S. (2024). GAN-SkipNet: A solution for data imbalance in cardiac arrhythmia detection using electrocardiogram signals from a benchmark dataset. Mathematics, 12(17), 2693.
[24] Karthik, G., Muppala, T., Chowdary, V., & Jayan, S. (2024, November). ECG Signal Classification and Anomaly Detection using LSTM and HMM Models. In 2024 11th International Conference on Advances in Computing and Communications (ICACC) (pp. 1-6). IEEE.
[25] Nair, V., & Hinton, G. E. (2010). Rectified linear units improve restricted boltzmann machines. In Proceedings of the 27th international conference on machine learning (ICML-10) (pp. 807-814).
[26] Bridle, J. (1989). Training stochastic model recognition algorithms as networks can lead to maximum mutual information estimation of parameters. Advances in neural information processing systems, 2.
[27] Available online at: https://physionet.org/content/mitdb/1.0.0
[28] Kingma, D. P., & Ba, J. (2014). Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980.
[29] Powers, D. M. (2020). Evaluation: from precision, recall and F-measure to ROC, informedness, markedness and correlation. arXiv preprint arXiv:2010.16061.
[30] Sasaki, Y. (2007). The truth of the F-measure. Teach tutor mater, 1 (5), 1–5.
[31] Brabec, J., Komárek, T., Franc, V., & Machlica, L. (2020, June). On model evaluation under non-constant class imbalance. In International Conference on Computational Science (pp. 74-87). Cham: Springer International Publishing.
[32] Siblini, W., Fréry, J., He-Guelton, L., Oblé, F., & Wang, Y. Q. (2020, April). Master your metrics with calibration. In International symposium on intelligent data analysis (pp. 457-469). Cham: Springer International Publishing.
[33] Chicco, D., & Jurman, G. (2020). The advantages of the Matthews correlation coefficient (MCC) over F1 score and accuracy in binary classification evaluation. BMC genomics, 21(1), 6.
[34] S. Sahoo, M. Dash, S. Behera and S. Sabut, "Machine learning approach to detect cardiac arrhythmias in ECG signals: A survey", Innov. Res. Biomed. Eng., vol. 41, pp. 185-194, 2020.
[35] Zhou, H., et al. (2023). "A Lightweight Multi-branch Transformer Network for ECG Arrhythmia Classification." in *IEEE Transactions on Instrumentation and Measurement.
[36] Mehra, R., & Štruc, V. (2024). "CardioSSL: A Self-Supervised Learning Framework for Multi-Label ECG Classification." in *IEEE Journal of Biomedical and Health Informatics (JBHI).