Unsupervised Transformer-Based Anomaly Detection in ECG Signals

Anomaly detection is one of the basic issues in data processing that addresses different problems in healthcare sensory data. Technology has made it easier to collect large and highly variant time series data; however, complex predictive analysis models are required to ensure consistency and reliabi...

Full description

Bibliographic Details
Main Authors: Abrar Alamr, Abdelmonim Artoli
Format: Article
Language:English
Published: MDPI AG 2023-03-01
Series:Algorithms
Subjects:
Online Access:https://www.mdpi.com/1999-4893/16/3/152
_version_ 1797613962801446912
author Abrar Alamr
Abdelmonim Artoli
author_facet Abrar Alamr
Abdelmonim Artoli
author_sort Abrar Alamr
collection DOAJ
description Anomaly detection is one of the basic issues in data processing that addresses different problems in healthcare sensory data. Technology has made it easier to collect large and highly variant time series data; however, complex predictive analysis models are required to ensure consistency and reliability. With the rise in the size and dimensionality of collected data, deep learning techniques, such as autoencoder (AE), recurrent neural networks (RNN), and long short-term memory (LSTM), have gained more attention and are recognized as state-of-the-art anomaly detection techniques. Recently, developments in transformer-based architecture have been proposed as an improved attention-based knowledge representation scheme. We present an unsupervised transformer-based method to evaluate and detect anomalies in electrocardiogram (ECG) signals. The model architecture comprises two parts: an embedding layer and a standard transformer encoder. We introduce, implement, test, and validate our model in two well-known datasets: ECG5000 and MIT-BIH Arrhythmia. Anomalies are detected based on loss function results between real and predicted ECG time series sequences. We found that the use of a transformer encoder as an alternative model for anomaly detection enables better performance in ECG time series data. The suggested model has a remarkable ability to detect anomalies in ECG signal and outperforms deep learning approaches found in the literature on both datasets. In the ECG5000 dataset, the model can detect anomalies with 99% accuracy, 99% F1-score, 99% AUC score, 98.1% recall, and 100% precision. In the MIT-BIH Arrhythmia dataset, the model achieved an accuracy of 89.5%, F1 score of 92.3%, AUC score of 93%, recall of 98.2%, and precision of 87.1%.
first_indexed 2024-03-11T07:02:56Z
format Article
id doaj.art-d698bff6b39e4b0898334219c97d86dd
institution Directory Open Access Journal
issn 1999-4893
language English
last_indexed 2024-03-11T07:02:56Z
publishDate 2023-03-01
publisher MDPI AG
record_format Article
series Algorithms
spelling doaj.art-d698bff6b39e4b0898334219c97d86dd2023-11-17T09:09:17ZengMDPI AGAlgorithms1999-48932023-03-0116315210.3390/a16030152Unsupervised Transformer-Based Anomaly Detection in ECG SignalsAbrar Alamr0Abdelmonim Artoli1Computer Science Department, College of Computer and Information Sciences, King Saud University, Riyadh 11543, Saudi ArabiaComputer Science Department, College of Computer and Information Sciences, King Saud University, Riyadh 11543, Saudi ArabiaAnomaly detection is one of the basic issues in data processing that addresses different problems in healthcare sensory data. Technology has made it easier to collect large and highly variant time series data; however, complex predictive analysis models are required to ensure consistency and reliability. With the rise in the size and dimensionality of collected data, deep learning techniques, such as autoencoder (AE), recurrent neural networks (RNN), and long short-term memory (LSTM), have gained more attention and are recognized as state-of-the-art anomaly detection techniques. Recently, developments in transformer-based architecture have been proposed as an improved attention-based knowledge representation scheme. We present an unsupervised transformer-based method to evaluate and detect anomalies in electrocardiogram (ECG) signals. The model architecture comprises two parts: an embedding layer and a standard transformer encoder. We introduce, implement, test, and validate our model in two well-known datasets: ECG5000 and MIT-BIH Arrhythmia. Anomalies are detected based on loss function results between real and predicted ECG time series sequences. We found that the use of a transformer encoder as an alternative model for anomaly detection enables better performance in ECG time series data. The suggested model has a remarkable ability to detect anomalies in ECG signal and outperforms deep learning approaches found in the literature on both datasets. In the ECG5000 dataset, the model can detect anomalies with 99% accuracy, 99% F1-score, 99% AUC score, 98.1% recall, and 100% precision. In the MIT-BIH Arrhythmia dataset, the model achieved an accuracy of 89.5%, F1 score of 92.3%, AUC score of 93%, recall of 98.2%, and precision of 87.1%.https://www.mdpi.com/1999-4893/16/3/152unsupervised transformersdeep learninganomaly detectionECG signal
spellingShingle Abrar Alamr
Abdelmonim Artoli
Unsupervised Transformer-Based Anomaly Detection in ECG Signals
Algorithms
unsupervised transformers
deep learning
anomaly detection
ECG signal
title Unsupervised Transformer-Based Anomaly Detection in ECG Signals
title_full Unsupervised Transformer-Based Anomaly Detection in ECG Signals
title_fullStr Unsupervised Transformer-Based Anomaly Detection in ECG Signals
title_full_unstemmed Unsupervised Transformer-Based Anomaly Detection in ECG Signals
title_short Unsupervised Transformer-Based Anomaly Detection in ECG Signals
title_sort unsupervised transformer based anomaly detection in ecg signals
topic unsupervised transformers
deep learning
anomaly detection
ECG signal
url https://www.mdpi.com/1999-4893/16/3/152
work_keys_str_mv AT abraralamr unsupervisedtransformerbasedanomalydetectioninecgsignals
AT abdelmonimartoli unsupervisedtransformerbasedanomalydetectioninecgsignals