Source-linked AI summary
HAN-ECG: An Interpretable Atrial Fibrillation Detection Model Using Hierarchical Attention Networks
Sajad Mousavi, Fatemeh Afghah, U. Rajendra Acharya
TL;DR
Deep-learning methods can detect AF but may not explain their decisions, while visual ECG review is time-consuming and subject to human error. HAN-ECG applies hierarchical attention to ECG waves, heartbeats, and windows, and the authors report better performance than existing algorithms on two AF databases. Its visualizations highlight clinically meaningful signal patterns.
Problem
Deep-learning AF detectors may be difficult to interpret, while visual ECG review is time-consuming and subject to human error.
Source: §1 · p. 1Method
HAN-ECG uses bidirectional recurrent networks and attention at wave, heartbeat, and multiple-heartbeat window levels to detect AF and identify influential signal regions.
Source: §1 · p. 2Results
Takeaways & Limitations
The visualizations show attention to irregular R-R intervals and absent P-waves, which the paper identifies as clinical features of AF.
Source: Qualitative analysis · p. 8The reported evaluation can include segments from the same subjects in training and test sets, creating a data-leakage concern.
Source: Quantitative analysis · p. 6
Abstract
from arXiv · showhide
Atrial fibrillation (AF) is one of the most prevalent cardiac arrhythmias that affects the lives of more than 3 million people in the U.S. and over 33 million people around the world and is associated with a five-fold increased risk of stroke and mortality. like other problems in healthcare domain, artificial intelligence (AI)-based algorithms have been used to reliably detect AF from patients' physiological signals. The cardiologist level performance in detecting this arrhythmia is often achieved by deep learning-based methods, however, they suffer from the lack of interpretability. In other words, these approaches are unable to explain the reasons behind their decisions. The lack of interpretability is a common challenge toward a wide application of machine learning-based approaches in the healthcare which limits the trust of clinicians in such methods. To address this challenge, we propose HAN-ECG, an interpretable bidirectional-recurrent-neural-network-based approach for the AF detection task. The HAN-ECG employs three attention mechanism levels to provide a multi-resolution analysis of the patterns in ECG leading to AF. The first level, wave level, computes the wave weights, the second level, heartbeat level, calculates the heartbeat weights, and third level, window (i.e., multiple heartbeats) level, produces the window weights in triggering a class of interest. The detected patterns by this hierarchical attention model facilitate the interpretation of the neural network decision process in identifying the patterns in the signal which contributed the most to the final prediction. Experimental results on two AF databases demonstrate that our proposed model performs significantly better than the existing algorithms. Visualization of these attention layers illustrates that our model decides upon the important waves and heartbeats which are clinically meaningful in the detection task.
1 INTRODUCTION
AF detection often relies on visual ECG review, a time-consuming process subject to human error, while deep-learning methods can be difficult to interpret. HAN-ECG combines hierarchical attention with bidirectional recurrent networks to detect AF and expose influential signal regions.
1 INTRODUCTION
- The approach targets a gap in deep-learning AF detection: models can detect complex ECG patterns but may not explain their decisions, limiting clinician trust.The paper presents attention as a way to make the relationship between inputs and the task interpretable.Source: §1 · p. 1
- On the MIT-BIH AFIB and PhysioNet Computing in Cardiology Challenge 2017 datasets, the proposed method significantly outperforms state-of-the-art algorithms for AF detection.The model’s attention visualizations also show which signal regions contribute to its decisions.Source: §1 · p. 2
- Three attention levels represent ECG waves, heartbeats, and windows of multiple heartbeats, with learned representations indicating signal parts that trigger an AF event.The architecture uses stacked bidirectional recurrent neural networks followed by attention at each level.Source: §1 · p. 2
- The authors report that important ECG regions identified by the model are clinically meaningful and may reveal potential patterns associated with life-threatening arrhythmias.The paper describes this as an empirical demonstration and a potential use of the approach.Source: §1 · p. 2
2 RELATED WORK
Prior AF-detection work includes convolutional and attention-based approaches, while the authors distinguish HAN-ECG by its interpretable, multilevel analysis of raw ECG signals. Its hierarchy spans windows, beats, and waves.
2 RELATED WORK
- Prior methods improved ECG heartbeat classification [11], while recurrent neural networks and sequence-to-sequence models performed automatic heartbeat annotation.An attention-based convolutional and recurrent neural network was used to suppress false arrhythmia alarms in the ICU.Source: §2 · p. 2
- Earlier AF detectors used deep convolutional networks, while used attention on fixed-length 30-second ECG windows with hand-crafted time-series covariates but was not interpretable.The authors also describe ECGNET as interpretable, using single-level attention and wavelet power spectra as input.Source: §2 · p. 2
- HAN-ECG uses hierarchical bidirectional recurrent and attention networks to provide interpretable predictions window by window, beat by beat, and wave by wave.The authors state that the model explains the reasons behind its decisions while improving detection performance.Source: §2 · p. 2
3 METHODOLOGY
The methodology prepares ECG recordings as nested sequences of waves and heartbeats, then applies recurrent encoders and attention at the wave, heartbeat, and window levels. The resulting signal representation is used for AF detection.
3.1 Pre-processing
- The model input is a sequence of heartbeats, each containing waves such as the P-wave, QRS complex, and T-wave.A heartbeat is defined from the onset of the current P-wave to the offset of the consecutive T-wave.Source: §3.1 · pp. 2–3
- ECG recordings are filtered, standardized, segmented at detected R peaks, and divided into heartbeats and constituent waves.The described filtering removes baseline wander and power-line interference; the passage identifies a band-pass filter with order 10 and pass band 0.5–50 Hz.Source: §3.1 · pp. 2–3
3.2 Model
- The wave encoder and attention summarize informative waves into heartbeat vectors, then heartbeat and window encoders with attention produce a summarized ECG representation for AF detection.Each window contains multiple heartbeat context vectors; the model has wave-, beat-, and window-level components.Source: §3.2 · p. 3
Bidirectional Recurrent Neural Networks
The model uses bidirectional recurrent neural networks (BiRNNs) to encode wave and beat sequences. Processing each sequence in both directions gives the current state access to previous and next input information.
Bidirectional Recurrent Neural Networks
- BiRNNs encode wave and beat vector sequences, providing access to previous and next input information at each state.The passage says BiRNNs are more efficient than standard RNNs when sequence length is very large.Source: Bidirectional Recurrent Neural Networks · p. 3
- The forward network processes waves or beats in regular order, while the backward network processes them in reverse.Their hidden states are computed in opposite temporal directions.Source: Bidirectional Recurrent Neural Networks · p. 3
- The BiRNN output is a weighted sum over concatenated forward and backward hidden states.The equations define each directional hidden state using the input and a neighboring hidden state; the prose identifies x_t and y_t as the input and output.Source: Bidirectional Recurrent Neural Networks · p. 3
Wave Encoder and Wave Attention
The wave encoder represents each heartbeat’s wave sequence with a bidirectional recurrent network, then uses attention to weight waves by their contribution to the heartbeat representation.
Wave Encoder
- A bidirectional recurrent network processes each heartbeat’s wave sequence in forward and reverse order to produce a latent representation for each wave.The input sequence runs from wave i1 to wave iT, with the backward network processing it in reverse.Source: Wave Encoder and Wave Attention · p. 3
Wave Attention
- A shallow attention network assigns wave-importance weights and uses them to form a weighted heartbeat context vector.The weights reflect that waves can differ in their contribution to representing a heartbeat.Source: Wave Encoder and Wave Attention · p. 4
- The attention weights are produced using learned parameters and a softmax function that maps values between 0 and 1.Source: Wave Encoder and Wave Attention · p. 4
Beat Encoder and Beat Attention
The beat encoder processes wave context vectors into latent heartbeat representations and applies attention to emphasize the heartbeats more important to triggering arrhythmia.
Beat Encoder
- A bidirectional recurrent network encodes the sequence of wave context vectors into latent representations of the input heartbeats.Source: Beat Encoder and Beat Attention · p. 5
Beat Attention
- A heartbeat-level attention mechanism emphasizes the heartbeats considered more important in triggering the arrhythmia.Source: Beat Encoder and Beat Attention · p. 5
- Each heartbeat context vector r_i is the element-wise product of its hidden state h_i and attention weight α_i.Source: Beat Encoder and Beat Attention · p. 5
Window Encoder and Window Attention
The window module groups heartbeat context vectors into overlapping windows, encodes them with a bidirectional recurrent network, and applies attention to represent the input ECG across multiple heartbeats.
Window Encoder
- Fixed-length windows are formed by sliding a predefined hop size across the heartbeat context vectors.For a window of three heartbeats and hop size one, consecutive windows overlap by two heartbeats.Source: Window Encoder and Window Attention · p. 5
Window Attention
- A bidirectional recurrent network encodes the windows, and attention measures their importance.Source: Window Encoder and Window Attention · p. 5
- The window context vector s encompasses information from the multi-heartbeat windows of the input ECG signal.Source: Window Encoder and Window Attention · p. 5
Detection
The detection stage combines the window context vector with the final hidden state, produces class probabilities, and trains with cross-entropy loss.
Detection
- The concatenated window context vector and last hidden state feed a shallow network and softmax to produce AF and non-AF probabilities.Source: Detection · p. 5
- The shallow network parameters are learned as part of the model.Source: Detection · p. 5
- Cross-entropy loss is used to calculate training loss from the ground-truth vector and predicted probabilities.Source: Detection · p. 5
Interpretation
HAN-ECG uses three attention levels to assign weights that indicate the importance of waves, heartbeats, and combinations of heartbeats in arrhythmia occurrence. Visualized examples highlight focused portions of AF and non-AF ECG signals.
Interpretation
- Wave, heartbeat, and window weights indicate each wave’s importance, each heartbeat’s influence on arrhythmia occurrence, and the importance of heartbeat combinations.The window level covers combinations of heartbeats.Source: Interpretation · p. 5
- The model presents interpretability as important for applying AI algorithms in real medical practice.Source: Interpretation · p. 5
- Visualized AF and non-AF ECG examples highlight the signal portions selected by the attention mechanism.Source: Interpretation · p. 5
4 EXPERIMENTS
The experiments evaluate HAN-ECG on MIT-BIH AFIB and PhysioNet Challenge 2017 data, comparing attention variants and examining attention visualizations. Reported results favor hierarchical variants in the described settings, while visualizations highlight clinically meaningful ECG patterns.
4.1 Data Description
- MIT-BIH AFIB evaluation used ECG1 recordings from 23 subjects, segmented into 5-s samples labeled AF when at least 50% of annotated beats were AF.The dataset had 66,939 AF and 100,483 non-AF segments; experiments also balanced the classes by random sampling.Source: §4.1 · pp. 5–6
- The PhysioNet dataset contains single-lead recordings, but its unavailable test set led the authors to use training data for both training and testing and retain only AF and normal classes.The recordings are 30–60 seconds long.Source: §4.1 · p. 6
4.2 Experimental Setup
- Experiments compared BiRNNs without attention against one-, two-, and three-level attention models using 10-fold cross-validation.Training used up to 25 epochs, batches of 64, and two BiRNN layers.Source: §4.2 · p. 6
4.3 Results
- The fixed-size HAN-ECG2f variant performed worst among proposed variants, while the RNN matched Xia et al.’s algorithm; the authors conclude preprocessing is necessary for better performance.HAN-ECG2f uses fixed 180-sample heartbeat portions subdivided into six parts treated as T-waves.Source: Quantitative analysis · p. 6
- On MIT-BIH AFIB, attention variants significantly outperformed listed methods, while HAN-ECG2 had slightly higher accuracy than HAN-ECG3 on 5-s segments.The authors suggest level-three heartbeat windowing adds little when a segment contains about six heartbeats, most containing AF.Source: Table 1 · p. 6, Quantitative analysis · p. 6
- With imbalanced data and training and test segments from different individuals, models with more attention layers again yielded higher accuracy and better performance.The authors report Table 2 results without an external comparison because they found no study using this evaluation scenario.Source: Quantitative analysis · pp. 6–7, Table 2 · p. 7
- On PhysioNet Challenge 2017, the authors report better performance for models with more than one attention layer in the two-class AF-versus-normal task.They note that the two-class setup had no literature comparison.Source: Table 3 · p. 7, Quantitative analysis · p. 7
- Attention visualizations highlight irregular R-R intervals and absent P-waves in AF, and normal heartbeat rhythms for non-AF detection.The figures encode heartbeat weights with red segments and important waves with blue strips and yellow circles.Source: Qualitative analysis · p. 8
5 CONCLUSIONS
The proposed three-level hierarchical attention model detects AF from a signal-lead ECG and provides wave-, heartbeat-, and window-level interpretations. On MIT-BIH AFIB and AFDB17, it achieves state-of-the-art performance, and its highlighted signal artifacts are reported as clinically meaningful.
5 CONCLUSIONS
- On MIT-BIH AFIB and AFDB17, the method achieves state-of-the-art performance and outperforms existing algorithms.The conclusion reports results on both databases without giving metric values.Source: §5 · p. 8
- Wave-, heartbeat-, and window-level attention assigns different weights to signal regions when labeling an ECG, supporting high-resolution interpretation.The conclusion says visualizations show the three levels considering different weights for parts of the signal.Source: §5 · p. 8
- The model's highlighted signal artifacts are reported as clinically meaningful; future work could test other ECG leads and arrhythmias for potential clinical features.Source: §5 · p. 8