Next Article in Journal
Dynamic Properties and Chaos Control Analysis of Discrete Epidemic Models Affected by Media Coverage
Previous Article in Journal
Reduced Order Data-Driven Twin Models for Nonlinear PDEs by Randomized Koopman Orthogonal Decomposition and Explainable Deep Learning
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Hierarchical Multiattention Temporal Fusion Network for Dual-Task Atrial Fibrillation Subtyping and Early Risk Prediction

1
School of Advanced Manufacturing, Fuzhou University, Quanzhou 362200, China
2
The Department of Microelectronics, College of Physics and Information Engineering, Fuzhou University, Fuzhou 350108, China
3
Department of Electronic Engineering, Feng Chia University, Taichung 40724, Taiwan
4
The Department of Electronic Engineering, Chung Yuan Christian University, Taoyuan City 320317, Taiwan
5
Department of Electrical Engineering, Ming Chi University of Technology, New Taipei City 243303, Taiwan
6
The Department of Information Systems and Computer Science, Ateneo de Manila University, Quezon City 1108, Philippines
*
Authors to whom correspondence should be addressed.
Mathematics 2025, 13(17), 2872; https://doi.org/10.3390/math13172872
Submission received: 11 August 2025 / Revised: 30 August 2025 / Accepted: 4 September 2025 / Published: 5 September 2025
(This article belongs to the Section E: Applied Mathematics)

Abstract

Atrial fibrillation (AF) is a common arrhythmia associated with major adverse cardiovascular events. Early detection and short-horizon risk prediction are therefore clinically critical. Prior attention-based electrocardiogram (ECG) models typically treated subtype classification and short-horizon onset risk prediction as separate tasks and optimized attention in only one representational dimension rather than in a coordinated hierarchy. We propose a hierarchical multiattention temporal fusion network (HMA-TFN). The proposed framework jointly integrates lead-level, morphology-level, and rhythm-level attention, enabling the model to simultaneously highlight diagnostically informative leads, capture waveform abnormalities, and characterize long-range temporal dependencies. Moreover, the model is trained for dual tasks—AF subtype classification and 30-min onset prediction. Experiments were conducted on three open-source databases and the Fuzhou University–Fujian Provincial Hospital (FZU-FPH) clinical database, comprising thousands of dual-lead ECG recordings from a diverse subject population. Experimental results show that HMA-TFN achieves 95.77% accuracy in classifying paroxysmal AF (PAAF) and persistent AF (PEAF), and 96.36% accuracy in predicting PAAF occurrence 30 min in advance. Ablations show monotonic gains as each attention level is added, delivering 14.0% accuracy over the baseline for subtyping and 5.2% for prediction. Grad-CAM visualization highlights clinically relevant features such as absent P-waves, confirming model interpretability. On the FZU-FPH clinical database, it achieves a generalization performance of 94.31%, demonstrating its strong potential for clinical application.

1. Introduction

Atrial fibrillation (AF) is the most prevalent clinical arrhythmia; it affects over 50 million individuals worldwide and is significantly associated with malignant cardiovascular complications including stroke and heart failure [1]. AF is classified into four patterns based on duration and termination: paroxysmal (PAAF), persistent (PEAF), long-standing persistent (LSPEAF), and permanent (PERMAF) [2]. PAAF exhibits abrupt onset and spontaneous termination, and asymptomatic intervals last for months. PAAF’s transient nature often eludes detection on routine electrocardiogram (ECG) [3]. Although detectable by standard ECG, LSPEAF and PERMAF are often diagnosed late when patients have already missed the optimal intervention window [4]. This persistent diagnostic gap underscores the critical imperative for developing timely, effective AF detection strategies.
Algorithms currently applied in the AF domain can be broadly categorized into classification and prediction paradigms. Classification algorithms primarily focus on binary discrimination between AF and normal sinus rhythm by establishing static associations between ECG characteristics and episode patterns. Feng et al. [5] achieved 98.5% accuracy using a deep ensemble method network. Makhir et al. [6] reported 98.97% sensitivity and 98.75% specificity with a domain-adaptive residual network. Argha et al. [7] attained 97.87% sensitivity and 99.29% specificity using a CNN-LSTM hybrid model on the MIT-BIH AF Database. Zhou et al. [8] developed a multimodal prediction model incorporating spatiotemporal ECG analysis and achieved 90.79% accuracy on multidimensional data. Wang [9] proposed an 11-layer CNN combined with a modified Elman neural network and obtained 97.4% accuracy, 97.9% sensitivity, and 97.1% specificity on the MIT-BIH AF database. Laith et al. [10] synthesized 171 studies to clarify the relationship between temporal dimensions and clinical objectives. They proposed that AF risk prediction models can be categorized by time scale (minute-scale to medium-to-long-term) and predicted events (immediate onset, onset, recurrence, and progression). The following are the specific categories and related studies:
Minute-scale AF immediate onset risk prediction: Laith et al. [10] developed WARN, a lightweight CNN model using R-R intervals, and delivered 83% accuracy with an average 30.8-min prediction horizon. Gliner et al. [11] proposed a Component-Aware Transformer model, achieved 92% accuracy in AF detection using single-lead ECGs, and demonstrated its potential for real-time AF onset prediction at millisecond resolution.
Short-term AF onset risk prediction: Wu et al. [12] utilized R-R-interval variability features in a gradient boosting decision tree to predict 2-h AF onset risk. Singh et al. [13] developed a machine learning model using clinical variables and ECG features to predict 2-h AF onset risk in patients with acute coronary syndrome and achieved an AUC of 0.832.
Short-to-medium-term AF recurrence risk prediction: Wang et al. [14] implemented an end-to-end deep learning architecture analyzing PPG signals from wearable devices for 48-h recurrence prediction. Zvuloni et al. [15] used a random forest model to analyze pre- and post-ablation 12-lead ECGs for predicting 30-day AF recurrence, achieved an AUC of 0.74, and underscored the importance of dynamic ECG morphology changes.
Medium-to-long-term AF progression risk prediction: Fu et al. [16] built a transfer learning-based survival model predicting 3-year progression to PEAF. Raghunath et al. [17] combined 12-lead ECG features with clinical variables in a random forest model to estimate 1-year incident AF risk. Wang et al. [18] developed a risk model combining Minnesota Code ECG classifications with clinical variables to predict 1-year incident AF risk and achieved an AUC of 0.84 in a worker population.
While classification algorithms use static feature mapping and prediction models employ risk-threshold stratification, this paper’s novel comodeling framework transcends single-task limitations in AF subtyping-prediction. The proposed approach fuses AF subtype classification with dynamic risk forecasting to extract premonitory electrophysiological instability signatures in patients with PAAF and to enable 30-min advance warnings. Multitask collaborative optimization enhances subtype discrimination and progression prediction within a single architecture.
Concurrently, innovations in attention mechanisms have opened new avenues for advanced feature extraction in ECG analysis, and strategic deployments span multiple analytical dimensions. Yildirim et al. [19] introduced a multilead attention mechanism with CNN BiGRU for dynamic lead weighting in myocardial infarction detection. Taniguchi et al. [20] proposed a dual-attention network using parallel channel spatial attention to adaptively fuse multi lead ECG features and significantly improved arrhythmia classification. Khurshid et al. [21] introduced PA2Net with cycle-aware attention for fetal ECG extraction, and its enhanced CSGSANet variant [22] further improved time–frequency feature representation in noisy conditions. Hirsch et al. [23] combined BiGRU with attention mechanisms to localize and adaptively weight key morphological fiducial points, and to boost noise robustness and morphological recognition precision substantially. For rhythm modeling, Godwin et al. [24] engineered a multistream attention CRNN incorporating GAN-based augmentation for analyzing clustered 9-s ECG segments. Wu et al. [25] achieved superior AF detection robustness using integrated multiscale convolution and adaptive feature enhancement. Rahul et al. [26] proposed a joint time–frequency attention RNN that uses temporal attention to localize critical beats and spectral attention to enhance rhythm relevant components and effectively modeled long-range dependencies for arrhythmia detection. Recent work by Xing et al. has demonstrated the application of advanced deep learning approaches to rehabilitation, including 3D graph deep learning with laser point clouds for hand segmentation and 3D deep learning with point cloud analysis for human–machine interaction in aging populations [27,28]. These studies highlight the broader potential of modern neural architectures to capture structural and morphological features from complex biomedical data, which motivates our exploration of morphology-aware models for atrial fibrillation analysis.
These advances demonstrate the effectiveness of attention mechanisms in adapting to ECG diagnostic patterns. They help optimize lead contributions, detect morphological changes, and capture rhythmic dependencies. However, existing studies have mainly concentrated on isolated attention optimizations within a single dimension, lacking hierarchical synergistic modeling, and have typically treated subtype classification and short-horizon risk prediction as independent tasks. To address these limitations, this study proposes a three-level cooperative attention framework capable of simultaneously performing subtype discrimination and short-term risk prediction, further enhanced with Gradient-weighted Class Activation Mapping (Grad-CAM) visual interpretability and validated on a real-world clinical cohort.
This study contributes to the literature as follows:
  • Advancing dual-task AF modeling. This study reframes AF analysis by unifying subtype classification and short-horizon risk prediction into a single end-to-end HMA-TFN framework. This dual-task formulation contributes a new paradigm for simultaneously addressing diagnostic classification and proactive risk assessment, thereby enriching AF detection and short-horizon risk strategies.
  • Hierarchical multiattention. By coordinating attention across lead, morphology, and rhythm levels, this work contributes a hierarchical mechanism that mirrors clinical reasoning—from multilead comparisons to waveform inspection and rhythm analysis. The demonstrated monotonic gains highlight the scientific value of progressive, synergistic feature integration over isolated attention approaches.

2. Methodology

The overall research framework is illustrated in Figure 1. The method standardizes data from three public ECG databases, then constructs a CNN-LSTM model enhanced with hierarchical attention across lead, morphology, and rhythm levels. Performance is evaluated on two tasks: PAAF/PEAF classification using Long-term Atrial Fibrillation Database (LTAFDB) and 30-min AF onset prediction using multisource data, including the Fuzhou University–Fujian Provincial Hospital (FZU-FPH) clinical database, to inform future research.

2.1. Datasets

This study used three public ECG databases from PhysioBank: MIT-BIH Atrial Fibrillation Database (MBAFDB) with 25 patients with PAAF, 23 two-lead 10-h records at 250 Hz from Beth Israel Hospital; MIT-BIH Normal Sinus Rhythm Database (MBNSRDB) with 18 normal subjects, two-lead 24-h records at 128 Hz from Beth Israel Hospital; LTAFDB with 84 patients with PAAF/PEAF, two-lead 24–25-h records at 128 Hz from Northwestern University. Additionally, the clinically derived FZU-FPH database, jointly developed by Fuzhou University and Fujian Provincial Hospital, provided 948 portable-system-acquired seven-lead, 10-min recordings (100 Hz) and 3000 multilead Holter datasets converted from PDF formats.
AF morphology and rhythm signatures are not equally expressed across leads. Lead V1 emphasizes atrial activity, including f-wave amplitude, dominant frequency, and P-terminal force, which are highly informative for detecting atrial fibrillation. Lead II, on the other hand, provides clearer P-wave morphology and more stable RR-interval regularity, features that facilitate reliable discrimination between sinus rhythm, pre-AF states, and paroxysmal versus persistent AF. Considering these complementary advantages, we adopted the leads II and V1 as the primary input for our model. This pairing not only reflects well-established clinical practice, where V1 and II are regarded as the most AF-sensitive leads, but also enhances the robustness of the model by combining morphological and rhythm-based information [29].
The LTAFDB was employed for PAAF versus PEAF classification and was partitioned into training, validation, and test sets at an 8:1:1 ratio. For PAAF onset prediction, LTAFDB and MBAFDB provided normal sinus rhythm segments (N’) within 30 min preceding AF episodes. These data were combined with pure normal sinus rhythm data (N) from the MBNSRDB and then divided into training, validation, and test sets at 8:1:1 ratio. The clinical FZU-FPH Database served exclusively as a clinical test set for PAAF prediction and contained 176 N’ samples and 176 N samples to validate model generalizability in real-world clinical settings. All ECG data were filtered, denoised, baseline-corrected, normalized, sorted into PAAF/PEAF and normal samples, and cut into 7.5-s fragments at a unified sampling rate for model input. Table 1 summarizes the details of the four databases.

2.2. Baseline Model Construction

Before adding a hierarchical multiattention mechanism, a baseline model is built as the preliminary feature extraction network for ECG signals. The structure of the model is shown in Figure 2. The proposed baseline model is a combination of CNN and Bi-LSTM.
The baseline model consists of an input layer, a CNN module, a Bi-LSTM module, a fully connected layer, and an output layer. In this study, the combination of CNN and BiLSTM is motivated by their complementary strengths. CNN is effective at capturing local morphological features such as P-wave absence, f-wave oscillations, and QRS morphology, but it is limited in modeling long-term temporal dependencies. BiLSTM, with its bidirectional memory, better represents the dynamic evolution of rhythms over time. Although some overlap exists in short-term feature modeling, CNN emphasizes local patterns while BiLSTM focuses on global dynamics [30]. Prior studies have shown that integrating convolutional features with recurrent modeling improves arrhythmia detection performance [31]. Therefore, the CNN–BiLSTM baseline has theoretical justification, providing a more comprehensive representation of AF characteristics than a single module alone.
A CNN is typically composed of several types of layers: convolutional layers, activation function layers, and pooling layers. In this study, the parameters of different convolutional layers are designed as follows: The convolution kernel sizes are designed to decrease progressively from 7 × 1 to 5 × 1 and finally to 3 × 1. This coarse-to-fine progression enables shallow layers to capture broader morphology and low-frequency components, while deeper layers specialize in sharper deflections and local transitions [32,33,34]. Meanwhile, the number of kernels increases from 32 to 64 and then to 128, allowing richer feature hierarchies to be extracted as temporal resolution decreases, while empirical tuning confirmed diminishing returns beyond 128 channels [35]. All convolutional layers adopt unit stride with same padding to preserve temporal alignment of atrial and ventricular landmarks, while pooling explicitly reduces dimensionality, enlarges the receptive field, and retains rhythm-critical information [35,36]. For activation functions, ReLU is used in CNN layers to enhance feature sparsity and avoid vanishing gradients, while Tanh is applied in the Bi-LSTM to stabilize temporal dynamics, followed by SoftMax for classification; these are widely accepted choices in ECG CNN–RNN architectures [37]. Baseline architecture details are presented in Table 2.

2.3. Lead-Level Attention

Because diagnostic features may reside in specific leads, an attention mechanism differentially weights each ECG lead to emphasize condition-relevant signals selectively. Given our two-lead data, lead-cascade attention processes interlead information. Lead-level attention first initializes the training parameters and then passes the two-lead signal through a two-layer neural network to extract features. Finally, a SoftMax activation maps the network’s output to attention scores [38], as shown in Formula (1).
α = s o f t m a x ( ( t a n h ( x · W + b ) ) · V ) ,    
where V , W , and b are the lead-level attention parameters learned during training; x represents the input data of the lead level attention module; α represents the calculated attention coefficient corresponding to each cardiac lead that is then multiplied with the original input to represent the output after the lead-level attention module.

2.4. Morphology-Level Attention

The ECG records the heart’s electrical activity. Each cardiac cycle comprises characteristic waveforms, including P wave, QRS complex, and T wave. To capture how different morphological features of these waveforms influence disease diagnosis, this paper introduces a Conditional Convolution (CondConv) layer. CondConv is a dynamic convolution method that adaptively generates convolutional kernel parameters based on input data. CondConv replaces static convolution kernels by dynamically determining kernel parameters from global input features. This mechanism enhances the model’s adaptability to heterogeneous data distributions. CondConv’s core concept lies in constructing dynamic weights via linear combinations of multiple expert kernels, which enables the network to learn input specific feature representations.
Let the input feature map be X R H × W × C i n . The output feature map of CondConv Y R H × W × C o u t is computed as follows [39]:
A global feature vector is extracted via Global Average Pooling (GAP):
g = G A P X R C i n    
Expert weights α R n are generated using a learnable matrix R R C i n × n and a Sigmoid function:
α = S i g m o i d g T R  
where n is the number of experts, and α = α 1 , α 2 , α n   s a t i s f i e s   i = 1 n α i = 1 . A dynamic kernel is synthesized: W d y n by weighted summation of n expert kernels W i R k × k × C i n × C o u t
W d y n = i = 1 n α i W i
The dynamic kernel is applied to the input feature map:
Y = W d y n   ×   X + b    
where b R C o u t denotes the bias term, and × represents the convolution operation.
The CondConv operation can be formally expressed as follows:
Y = σ ( ( i = 1 n α i W i )   ×   X )      
To capture detailed ECG features, the conditional parameterized convolutional layer uses 128 kernels of size 3 × 1, with stride 1 × 1 and padding to preserve input–output dimensions. The conditional parameterized convolutional layer employs ReLU activation, and with the number of experts set to n = 3, each sample’s convolution kernel is computed as a linear combination of three kernel sets. In this way, the learning ability of the model can be improved while controlling the amount of computation. The flowchart for the implementation of the final morphological-level attention is shown in Figure 3, where GAP represents the global average pooling, num_experts represents the number of experts as 3, and Matmul presents the matrix multiplication.
The three expert kernels in the morphological-level attention module were initialized using standard random initialization rather than manually encoding AF specific morphological priors. This choice is based on established CNN theory, where random initialization combined with sufficient data and appropriate optimization reliably leads to convergence toward clinically meaningful filters. Previous work has shown that convolutional kernels trained from random initializations can successfully learn atrial-related morphological features such as P-wave absence, f-wave oscillations, and irregular RR intervals without handcrafted priors [30,31]. Moreover, the conditional convolution mechanism further guides the learning process by dynamically weighting expert kernels according to input-specific morphology, thus accelerating convergence toward AF relevant patterns.

2.5. Rhythm-Level Attention

ECG signals exhibit inherent rhythmic relationships reflecting the heart’s regular electrical activity. Analyzing these rhythms is crucial for assessing cardiac function and diagnosing pathologies. This paper employs a rhythm-level attention mechanism to capture temporal dependencies and rhythmic patterns in long-duration ECG waveforms. This approach enables comprehensive modeling of how these patterns influence disease diagnosis and offers a deep insight into cardiac health. The rhythm-level attention employs the Q, K, and V computation pattern [40]. This pattern refers to mapping different position vectors of the input sequence into three distinct spaces. Specifically, through non-linear mapping of the input sequence via fully connected layers, three vectors are obtained: the query vector Q, key vector K, and value vector V. Assuming the input sequence is X = [ x 1 , x 2 , x n ] , the computation is shown in Formulas (7)–(9) and yields Q = [ q 1 , q 2 q n ] , K = [ k 1 , k 2 k n ] , and V = [ v 1 , v 2 v n ] as matrices composed of query, key, and value vectors, respectively.
Q = D e n s e q X  
K = D e n s e k X  
V = D e n s e v X    
After obtaining the Q , K , and V vectors, for each query vector q n Q at position n , its correlation with key vectors at all other positions is calculated to derive the corresponding attention weights for the key vectors at the remaining positions. Finally, multiplying these attention weights with the value vectors at their respective positions yields the output of the self-attention mechanism, as illustrated in Figure 4.
This computation is represented by Formula 10, where h n denotes the output vector at position n computed from the query vector at that position. Here, n , j [ 1 , N ] represent the positions of vectors in the output and input sequences, respectively. γ n j signifies the attention weight generated by the correlation calculation between the n-th and j-th positions in the input sequence, and s ( q n , k j ) represents the correlation computation between these two positions. The weights are then mapped to the interval [0, 1] using the SoftMax activation function.
h n = a t t e n t i o n K ,   V ,     q n = j = 1 N γ n j v j = j = 1 N s o f t m a x s   q n ,   k j v j

2.6. Hierarchical Multiattention Temporal Fusion Network Construction

The specific integration architecture of the final hierarchical multiattention mechanism with the baseline model is illustrated in Figure 5, which demonstrates the hierarchical fusion of three attention modules:
  • Lead-level attention dynamically weights two-lead ECG signals through channel-wise attention gates.
  • Morphology-level attention integrates CondConv generated kernels to emphasize waveform-specific features (P-wave suppression and F-wave enhancement).
  • Rhythm-level attention applies multihead temporal self-attention to model arrhythmic patterns.

3. Experimental Results and Analysis

3.1. Basic Setting

All experiments were conducted on workstations equipped with NVIDIA GeForce 3090 GPU, Intel (R) Xeon (R) Silver 4114 CPU @ 2.20 GHz CPU. The software environment included Ubuntu 22.04 operating system, Python 3.9.21, TensorFlow 2.19, CUDA 12.4. For model training, the Adam Optimizer was adopted with an initial learning rate of 0.001, and the cross-entropy loss function was used to optimize the model parameters. The model was trained for 200 epochs with a batch size of 32. The validation set monitored performance and prevented overfitting. The checkpoint with the highest validation accuracy was saved as the best model.

3.2. Model Evaluation Metrics

Model evaluation metrics quantify a deep learning model’s predictive performance, accuracy, and stability. Before calculation, a confusion matrix (Table 3) was constructed. The key terms were defined as follows. True Positive ( T P ): The sample’s true label and predicted label are both positive. True Negative ( T N ): The sample’s true label and predicted label are both negative. False Positive ( F P ): The sample’s true label is negative, but the predicted label is positive. False Negative ( F N ): The sample’s true label is positive but the predicted label is negative.
The main evaluation indicators in this paper include accuracy rate, recall rate, precision, specificity, and F 1 score. These metrics evaluate the model’s classification performance from multiple perspectives and provide a comprehensive assessment of accuracy, sensitivity, specificity, and other relevant factors [41]. The corresponding calculation expressions are shown as follows:
A c c u r a c y = T P + T N T P + F P + T N + F N × 100 %
R e c a l l = T P T P + F N × 100 %
P r e c i s i o n = T P T P + F P × 100 %
S p e c i f i c i t y = T N T N + F P × 100 %    
F 1 = 2 × P r e c i s i o n × R e c a l l P r e c i s i o n + R e c a l l × 100 %    

3.3. Classification of Paroxysmal Atrial Fibrillation and Persistent Atrial Fibrillation

To investigate the effect of the proposed three-level attention mechanism on model performance, classification of PAAF and PEAF was conducted on the validation set. The experiments were conducted under different model architecture configurations, as presented in Table 4.
Model A consists of the baseline model. Model B is composed of the baseline model and lead-level attention. Model C consists of the baseline model, lead-level attention, and morphology-level attention. Model D is made up of the baseline model, lead-level attention, morphology-level attention, and rhythm-level attention.
The confusion matrix generated on the validation set is presented in Figure 6. The calculation results of various indicator performances of different models on the validation set are shown in Table 5. The accuracies of models A, B, C, and D are 81.66%, 86.77%, 92.33%, and 95.66%, respectively. The accuracy gradually increases from model A to model D, which proves the effectiveness of the multilevel attention mechanism model.
During the model training, the curves showing the changes in the accuracy and loss function values of the training set and the validation set with the number of training batches are shown in Figure 7.
In recent years, research on the classification of PAAF and PEAF is still in its initial stage, so related literature is limited. After a review, the comparison results of specific research methods and model performances from recent studies with those of this paper are shown in Table 6.
Table 6 indicates that most current AF classification studies still rely on manual ECG feature extraction via signal analysis. These features are then processed by classical machine learning algorithms, which limits the models’ generalization ability. This paper employs deep learning to bypass manual feature extraction. This paper proposes a hierarchical multiattention temporal fusion network based on CNN-LSTM to analyze raw dual-lead ECG signals. The proposed model outperforms related studies in classification performance.

3.4. Early Prediction of Paroxysmal Atrial Fibrillation

For the experiment of predicting PAAF in advance, the databases MBAFDB, LTAFDB, MBNSRDB, and FZU-FPH were used. The normal sinus rhythm data within 30 min before the onset of PAAF in patients were extracted. As shown in Figure 8, these data were labeled as N’. After screening, 23 patients from the LTAFDB and 19 patients from the MBAFDB met the criteria. Then, 18 subjects from the MBNSRDB were regarded as a normal sinus rhythm population who had never experienced AF. Completely normal sinus rhythm data were extracted from them and labeled as N.
The HMA-TFN model was used to learn and train for the problem of predicting PAAF in advance. This approach is equivalent to solving a binary classification problem between completely normal sinus rhythm and normal sinus rhythm before the onset of AF. The confusion matrices generated by the four models on the validation are shown in Figure 9.
Moreover, the calculation results of various indicator performances of different models on the validation set are shown in Table 7. The accuracies of models A, B, C, and D are 90.28%, 92.38%, 94.26%, and 95.51%, respectively. The F 1 scores of models A, B, C, and D are 90.27%, 92.34%, 94.25%, and 95.50%, respectively. The accuracy and the F1 score gradually increase from model A to model D, which proves that the hierarchical multiattention mechanism can improve the performance of the model. During the model training, the curves showing the changes in the accuracy and loss function values of the training set and the validation set with the number of training batches are shown in Figure 10.
To validate the model in real clinical populations, the FZU-FPH database, developed by our laboratory and Fujian Provincial Hospital, was introduced. This dataset primarily consists of recordings collected using Holter medical devices. Patients with PAAF exhibiting AF episodes lasting over 30 min and at least 60 min of preceding normal sinus rhythm were screened. Then, sinus rhythm segments within 30 min before AF onset extracted and labeled as N′, and those more than 30 min before onset were labeled as N. Finally, the classes were balanced by selecting 176 samples per label to form the clinical test set.
These clinical data samples were applied to the hierarchical multiattention mechanism model based on CNN-LSTM, and the specific model performance metrics are listed in Table 8. The model achieved an accuracy of 94.31%, which indicates good generalization ability on the clinical test set and demonstrates certain reference value for clinical applications.
After a review, recent studies on AF prediction were compared with this paper, focusing on a comparative analysis from three aspects, namely, research methods, advance prediction time, and model performance, as shown in Table 9.
As shown in Table 9, the prediction time horizons for advance prediction of AF in various studies vary, ranging from as short as 30 s to 5 min to as long as 2 weeks to 2 months. Overall, as the prediction time horizon extends, the prediction performance of the models generally declines. Extending the prediction window enables more precise and timely AF warnings but increases complexity and reduces model accuracy.
This paper adopts a median prediction time horizon from most existing studies and targets a 30-min advance prediction of PAAF. The model’s performance metrics outperform those of most comparable studies and effectively enables accurate prediction and early warning for patients with PAAF.

3.5. Visualization Analysis of Attention Weights

Grad-CAM is a classic deep learning technique for visualizing model decisions. Grad-CAM helps break the “black-box” nature of classification predictions and improves model interpretability. This paper uses Grad-CAM to explain visually the features learned by the multilevel attention model. The multilevel attention model assigns different weights to different time segments of ECG signals and helps the model focus on the most informative parts of the data signals.
As shown in Figure 11, Grad-CAM is used to visualize the features learned by the model as heatmaps. Darker colors indicate segments of the ECG signal that receive higher attention weights from the model.
From Figure 11a, which corresponds to AF samples, the highlighted regions coincide with the disappearance of the P wave and the emergence of continuous, irregular F waves. This indicates that the model correctly attends to clinically relevant abnormalities when detecting AF. In contrast, Figure 11b shows normal ECGs, where the attention distribution is relatively uniform and primarily concentrated on the QRS complex. This suggests that for normal rhythms the model emphasizes ventricular depolarization, consistent with clinical interpretation.
These observations confirm that the proposed multilevel attention model learns features aligned with established clinical markers. The visualization thus demonstrates the model’s interpretability and its effectiveness in identifying abnormal atrial activity associated with AF.

4. Conclusions

This study proposed a hierarchical multiattention temporal fusion network integrating CNN and Bi-LSTM architectures for AF analysis. The model achieved high accuracy in classifying PAAF and PEAF (95.77%) and in predicting PAAF episodes 30 min before onset (96.36%). It incorporated lead-specific weighting, adaptive morphological feature extraction using CondConv, and rhythm-aware self-attention to capture discriminative ECG patterns. Grad-CAM visualizations confirmed its focus on clinical markers such as P-wave abnormalities and irregular RR intervals. The framework was validated on clinical data from the FZU-FPH database and achieved 94.31% accuracy, demonstrating good generalizability across clinical settings. However, the study has several limitations. Due to database constraints, only two-lead ECG signals were used, limiting the cardiac information available for analysis. The model also contains a relatively large number of parameters, which increases computational complexity. Future work could explore lightweight architectures and edge-computing deployment to enable real-time monitoring on wearable devices. Additionally, the analysis relied solely on ECG data; integrating multimodal information such as physiological signals and medical imaging may further enhance diagnostic accuracy. This study demonstrates the feasibility and effectiveness of combining multi-level attention mechanisms with temporal modeling for AF detection and prediction. Future extensions in these directions are expected to improve both the clinical utility and interpretability of the framework.

Author Contributions

Conceptualization, J.-W.W., C.-X.X., B.-J.C., T.Y. and L.-H.W.; methodology, J.-W.W., B.-J.C., C.-X.X., T.Y. and L.-H.W.; software, J.-W.W. and B.-J.C.; validation, J.-W.W., C.-X.X., and T.Y.; formal analysis, J.-W.W., B.-J.C. and Z.-J.L.; investigation, J.-W.W., C.-X.X. and T.-Y.C.; resources, L.-H.W., Z.-J.L., T.Y. and S.-L.C.; data curation, J.-W.W., B.-J.C. and C.-A.C.; writing—original draft preparation, J.-W.W., B.-J.C., L.-H.W. and T.Y.; writing—review and editing, J.-W.W., C.-X.X. and T.Y.; visualization, P.A.R.A.; supervision, L.-H.W., Z.-J.L. and T.Y.; funding acquisition, L.-H.W. and Z.-J.L. All authors have read and agreed to the published version of the manuscript.

Funding

This study was funded by the National Natural Science Foundation of China and the Major Project and Innovation Platform of the Science and Technology Agency of Fujian Province under Grant Nos. 61971140, 2020IM010200, and 2021H6003, 2021D036, 2022J01549, and 2023J01258.

Data Availability Statement

The original contributions presented in this study are included in the article. Further inquiries can be directed to the corresponding authors.

Acknowledgments

The authors are grateful to Fuzhou University, Intelligence Health System and Biologic Integrated Circuits Development International (Hong Kong, Macao and Taiwan) Joint Laboratory on Fuzhou University.

Conflicts of Interest

The authors declare no conflicts of interest.

References

  1. The Writing Committee of the Report on Cardiovascular Health and Diseases in China. Report on cardiovascular health and diseases in China 2022: An updated summary. Chin. J. Interv. Cardiol. 2023, 31, 1004–8812. [Google Scholar] [CrossRef]
  2. Hindricks, G.; Potpara, T.; Dagres, N.; Arbelo, E.; Bax, J.J.; Blomström-Lundqvist, C.; Boriani, G.; Castella, M.; Dan, G.-A.; Dilaveris, P.E.; et al. 2020 ESC Guidelines for the diagnosis and management of atrial fibrillation developed in collaboration with the European Association for Cardio-Thoracic Surgery (EACTS). Eur. Heart J. 2021, 42, 373–498. [Google Scholar] [CrossRef] [PubMed]
  3. Svennberg, E.; Tjong, F.; Goette, A.; Akoum, N.; Di Biase, L.; Bordachar, P.; Boriani, G.; Burri, H.; Conte, G.; Deharo, J.C.; et al. How to use digital devices to detect and manage arrhythmias: An EHRA practical guide. Europace 2022, 24, 979–1005. [Google Scholar] [CrossRef] [PubMed]
  4. Choi, S.E.; Sagris, D.; Hill, A.; Lip, G.Y.H.; Abdul, R.A.H. Atrial fibrillation and stroke. Expert Rev. Cardiovasc. Ther. 2023, 21, 35–56. [Google Scholar] [CrossRef]
  5. Feng, K.; Fan, Z. A novel bidirectional LSTM network based on scale factor for atrial fibrillation signals classification. Biomed. Signal Process. Control 2023, 76, 1746–8094. [Google Scholar] [CrossRef]
  6. Makhir, A.; Alaoui, H.E.; Jilbab, A.; Bellarbi, L. Classification of Atrial Fibrillation and Cardiac Arrhythmias by a CNN-BiLSTM Hybrid Model with DWT Preprocessing. In Proceedings of the 2024 4th International Conference on Innovative Research in Applied Science, Engineering and Technology (IRASET), Fez, Morocco, 16–17 May 2024; pp. 1–5. [Google Scholar] [CrossRef]
  7. Argha, A.; Hamid, A.R.; Martin, B. A Novel Deep Ensemble Method for Selective Classification of Electrocardiograms. IEEE Trans. Biomed. Eng. 2025, 72, 833–842. [Google Scholar] [CrossRef]
  8. Zhou, Z.; Chen, Y.; Zhang, F.; Liu, H.; Karimi, H.R.; Cao, J. Multimodal prediction of catheter ablation outcomes in patients with persistent atrial fibrillation. Neural Netw. 2025, 191, 107835. [Google Scholar] [CrossRef]
  9. Wang, Y.N.; Liu, S.; Jia, H.J. A two-step method for paroxysmal atrial fibrillation event detection based on machine learning. Math. Biosci. Eng. 2022, 19, 9877–9894. [Google Scholar] [CrossRef]
  10. Laith, A.; Yaman, J.; Zaid, A.F.; Emmanuel, O.; Justin, L.; Jana, A. A machine learning–based risk prediction model for atrial fibrillation in critically ill patients. Heart Rhythm. O2 2025, 6, 652–660. [Google Scholar] [CrossRef]
  11. Gliner, V.; Yaniv, Y. An SVM approach for identifying atrial fibrillation. Physiol. Meas. 2018, 39, 1361–6579. [Google Scholar] [CrossRef]
  12. Wu, X.; Zheng, Y.; Chu, C.-H.; He, Z. Extracting deep features from short ECG signals for early atrial fibrillation detection. Artif. Intell. Med. 2020, 109, 101896. [Google Scholar] [CrossRef] [PubMed]
  13. Singh, R.; Rajpal, N.; Mehta, R. An empiric analysis of wavelet-based feature extraction on deep learning and machine learning algorithms for arrhythmia classification. Int. J. Interact. Multimed. Artif. Intell. 2021, 6, 25–34. [Google Scholar] [CrossRef]
  14. Wang, J.; Wang, P.; Wang, S. Automated detection of atrial fibrillation in ECG signals based on wavelet packet transform and correlation function of random process. Biomed. Signal Process. Control 2019, 55, 101662. [Google Scholar] [CrossRef]
  15. Zvuloni, E.; Levi, N.; Marai, I.; Shenhar, Y.; Suleiman, M.; Amit, G. Machine Learning Analysis of Pre- and Post-Ablation Electrocardiograms for Prediction of Atrial Fibrillation Recurrence. J. Cardiovasc. Electrophysiol. 2023, 34, 567–575. [Google Scholar] [CrossRef]
  16. Fu, L.; Lu, B.; Nie, B.; Peng, Z.; Liu, H.; Pi, X. Hybrid Network with Attention Mechanism for Detection and Location of Myocardial Infarction Based on 12-Lead Electrocardiogram Signals. Sensors 2020, 20, 1020. [Google Scholar] [CrossRef]
  17. Raghunath, S.; Pfeifer, J.M. Deep Neural Networks Can Predict New Onset Atrial Fibrillation From the 12-Lead Electrocardiogram and Help Identify Those at Risk of AF-Related Stroke. Circulation 2021, 143, 1287–1298. [Google Scholar] [CrossRef]
  18. Wang, X.; He, Z.S.; Lin, Z.J.; Han, Y. PA2Net: Period-Aware Attention Network for Robust Fetal ECG Detection. IEEE Trans. Instrum. Meas. 2022, 71, 2513812. [Google Scholar] [CrossRef]
  19. Yildirim, O.; Talo, M.; Ciaccio, E.J. Accurate deep neural network model to detect cardiac arrhythmia on more than 10,000 individual subject ECG records. Comput. Methods Programs Biomed. 2020, 197, 105740. [Google Scholar] [CrossRef]
  20. Taniguchi, H.; Takata, T.; Takechi, M. Explainable Artificial Intelligence Model for Diagnosis of Atrial Fibrillation Using Holter Electrocardiogram Waveforms. Int. Heart J. 2021, 62, 534–539. [Google Scholar] [CrossRef]
  21. Khurshid, S.; Friedman, S.; Reeder, C. ECG-based deep learning and clinical risk factors to predict atrial fibrillation. Circulation 2022, 145, 122–133. [Google Scholar] [CrossRef]
  22. Elias, E.; Maede, K.; Mohammadamin, J. Prediction of Paroxysmal Atrial Fibrillation: A Machine Learning Based Approach Using Combined Feature Vector and Mixture of Expert Classification on HRV Signal. Comput. Methods Programs Biomed. 2018, 165, 53–67. [Google Scholar] [CrossRef] [PubMed]
  23. Hirsch, G.; Jensen, S.H.; Poulsen, E.S.; Puthusserypady, S. Atrial fibrillation detection using heart rate variability and atrial activity: A hybrid approach. Expert Syst. Appl. 2021, 169, 114452. [Google Scholar] [CrossRef]
  24. Godwin, M.; Ester, N.; Jaeseok, Y. Enhancing atrial fibrillation classification from single-lead electrocardiogram signals using attention-based networks and generative adversarial networks with density-based clustering. Eng. Appl. Artif. Intell. 2025, 133, 108607. [Google Scholar] [CrossRef]
  25. Wu, X.; Yan, M.; Wang, R.; Xie, L. Multiscale feature enhanced gating network for atrial fibrillation detection. Comput. Methods Programs Biomed. 2025, 261, 108606. [Google Scholar] [CrossRef]
  26. Rahul, J.; Sharma, L.D. Artificial Intelligence-Based Approach for Atrial Fibrillation Detection Using Normalised and Short-Duration Time-Frequency ECG. Biomed. Signal Process. Control 2022, 71, 103270. [Google Scholar] [CrossRef]
  27. Xing, Z.; Ma, G.; Wang, L.; Yang, L.; Guo, X.; Chen, S. Toward Visual Interaction: Hand Segmentation by Combining 3-D Graph Deep Learning and Laser Point Cloud for Intelligent Rehabilitation. IEEE Internet Things J. 2025, 12, 21328–21338. [Google Scholar] [CrossRef]
  28. Xing, Z.; Meng, Z.; Zheng, G.; Ma, G.; Yang, L.; Guo, X.; Tan, L.; Jiang, Y.; Wu, H. Intelligent Rehabilitation in an Aging Population: Empowering Human–Machine Interaction for Hand Function Rehabilitation Through 3D Deep Learning and Point Cloud. Front. Comput. Neurosci. 2025, 19, 1543643. [Google Scholar] [CrossRef]
  29. Lin, Y.C.; Antonio, L.; Pyotr, G.; Iwona, C.; Elsayed, Z. P Wave Parameters and Indices: A Critical Appraisal of Clinical Utility, Challenges, and Future Research—A Consensus Document Endorsed by the International Society of Electrocardiology and the International Society for Holter and Noninvasive Electrocardiology. Circ. Arrhythmia Electrophysiol. 2022, 15, 427–437. [Google Scholar] [CrossRef]
  30. LeCun, Y.; Bengio, Y.; Hinton, G. Deep learning. Nature 2015, 521, 436–444. [Google Scholar] [CrossRef]
  31. He, K.; Zhang, X.; Ren, S.; Sun, J. Deep residual learning for image recognition. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), Las Vegas, NV, USA, 27–30 June 2016; pp. 770–778. [Google Scholar] [CrossRef]
  32. Liu, S.; Wang, A.; Deng, X.; Yang, C. MGNN: A Multiscale Grouped Convolutional Neural Network for Efficient Atrial Fibrillation Detection. Comput. Biol. Med. 2022, 148, 105863. [Google Scholar] [CrossRef]
  33. Lee, K.-S.; Jung, S.; Gil, Y.; Son, H.S. Atrial Fibrillation Classification Based on Convolutional Neural Networks. BMC Med. Inform. Decis. Mak. 2019, 19, 1–6. [Google Scholar] [CrossRef]
  34. Oh, S.L.; Ng, E.Y.K.; Tan, R.S.; Acharya, U.R. Automated Diagnosis of Arrhythmia Using Combination of CNN and LSTM Techniques with Variable Length Heart Beats. Comput. Biol. Med. 2018, 102, 278–287. [Google Scholar] [CrossRef] [PubMed]
  35. Li, D.; Zhang, J.; Zhang, Q.; Wei, X. Classification of ECG Signals Based on 1D Convolution Neural Network. In Proceedings of the IEEE 19th International Conference on e-Health Networking, Applications and Services (Healthcom), Dalian, China, 12–15 October 2017; pp. 1–6. [Google Scholar] [CrossRef]
  36. Rawal, V.; Prajapati, P.; Darji, A. Hardware Implementation of 1D-CNN Architecture for ECG Arrhythmia Classification. Biomed. Signal Process. Control 2023, 85, 104865. [Google Scholar] [CrossRef]
  37. Ouni, R.; Alhichri, H.; Kharshid, A. Lightweight Residual Convolutional Neural Network for Atrial Fibrillation Detection in Single-Lead ECG Recordings. Eng. J. 2024, 28, 67–80. [Google Scholar] [CrossRef]
  38. Bahdanau, D.; Cho, K.; Bengio, Y. Neural Machine Translation by Jointly Learning to Align and Translate. Int. Conf. Learn. Represent. 2015, 13, 37–53. [Google Scholar] [CrossRef]
  39. Yang, B.; Bender, G.; Le, Q.V. CondConv: Conditionally Parameterized Convolutions for Efficient Inference. arXiv 2019. [Google Scholar] [CrossRef]
  40. Vaswani, A.; Shazeer, N.; Parmar, N.; Uszkoreit, J.; Jones, L.; Gomez, A.N.; Kaiser, L.; Polosukhin, I. Attention Is All You Need. arXiv 2017. [Google Scholar] [CrossRef]
  41. Sokolova, M.; Lapalme, G. A Systematic Analysis of Performance Measures for Classification Tasks. Inf. Process. Manag. 2009, 45, 427–437. [Google Scholar] [CrossRef]
  42. Yang, B. Research on a Prediction Method for Atrial Fibrillation Based on LDA Machine Learning. In Proceedings of the 2024 5th International Conference on Big Data & Artificial Intelligence & Software Engineering (ICBASE), Wenzhou, China, 20–22 September 2024; pp. 830–833. [Google Scholar] [CrossRef]
  43. Li, Y.; Tang, X.; Wang, A.; Tang, H. Probability Density Distribution of Delta RR Intervals for Atrial Fibrillation Detection. Australas. Phys. Eng. Sci. Med. 2017, 40, 707–716. [Google Scholar] [CrossRef]
  44. Singh, J.P.; Fontanarava, J.; Masse, D.G. Short-term prediction of atrial fibrillation from ambulatory monitoring ECG using a deep neural network. Eur. Heart J.-Digit. Health 2022, 3, 208–217. [Google Scholar] [CrossRef]
  45. Myrovali, E.; Hristu, V.D.; Tachmatzidis, D. Identifying patients with paroxysmal atrial fibrillation from sinus rhythm ECG using random forests. Expert Syst. Appl. 2023, 213, 118948. [Google Scholar] [CrossRef]
  46. Kim, Y.; Lee, M.; Yoon, J. Predicting Future Incidences of Cardiac Arrhythmias Using Discrete Heartbeats from Normal Sinus Rhythm ECG Signals via Deep Learning Methods. Diagnostics 2023, 13, 2849. [Google Scholar] [CrossRef] [PubMed]
  47. Kraft, D.; Rumm, P. Atrial Fibrillation and Atrial Flutter Detection Using Deep Learning. Sensors 2025, 25, 4109. [Google Scholar] [CrossRef] [PubMed]
  48. Xie, L.; Wang, L.; Mo, D.; Zhang, Z.; Liang, M. Intelligent algorithms powered smart devices for atrial fibrillation discrimination. Biomed. Signal Process. Control 2025, 103, 107480. [Google Scholar] [CrossRef]
  49. Wang, Z.; Zhang, F.; Jin, Q.; Wang, Y.; Wang, W.; Deng, D. Transcriptome Analysis of Different Life-History Stages and Screening of Male-Biased Genes in Daphnia sinensis. BMC Genom. 2022, 23, 589. [Google Scholar] [CrossRef]
  50. Duangburong, N.; Limsakul, C. Comparison of ANN and ANFIS Models for AF Diagnosis Using RR Irregularities. Appl. Sci. 2023, 13, 1712. [Google Scholar] [CrossRef]
  51. Hirsch, O.; Shenfield, A.; Kareem, M.; San, T.R.; Fujita, H.; Acharya, U.R. Automated detection of atrial fibrillation using long short-term memory network with RR interval signals. Comput. Biol. Med. 2018, 102, 327–335. [Google Scholar] [CrossRef]
  52. Parsi, Y.S.; Lee, S.C.; Choi, W.I.; Kim, D.H. Prediction of atrial fibrillation from normal ECG using artificial intelligence in patients with unexplained stroke. Eur. Heart J. 2020, 41, 348. [Google Scholar] [CrossRef]
  53. Tzou, H.A.; Lin, S.F.; Chen, P.S. Paroxysmal atrial fibrillation prediction based on morphological variant P-wave analysis with wideband ECG and deep learning. Comput. Methods Programs Biomed. 2021, 211, 106396. [Google Scholar] [CrossRef]
  54. Petmezas, G.; Haris, K.; Stefanopoulos, L.; Kilintzis, V.; Tzavelis, A.; Rogers, J.A.; Katsaggelos, A.K.; Maglaveras, N. Automated Atrial Fibrillation Detection Using a Hybrid CNN-LSTM Network on Imbalanced ECG Datasets. Biomed. Signal Process. Control 2021, 63, 102194. [Google Scholar] [CrossRef]
  55. Liu, L.; Liu, F.; Ren, X.; Li, Y.; Han, B.; Zhang, L.; Wei, S. Predicting spontaneous termination of atrial fibrillation based on dual path network and feature selection. Biomed. Signal Process. Control 2024, 88, 105606. [Google Scholar] [CrossRef]
Figure 1. Overall research process framework of this paper.
Figure 1. Overall research process framework of this paper.
Mathematics 13 02872 g001
Figure 2. Network structure of the baseline model.
Figure 2. Network structure of the baseline model.
Mathematics 13 02872 g002
Figure 3. Flowchart of the implementation of morphological-level attention.
Figure 3. Flowchart of the implementation of morphological-level attention.
Mathematics 13 02872 g003
Figure 4. Rhythm-level attention diagram.
Figure 4. Rhythm-level attention diagram.
Mathematics 13 02872 g004
Figure 5. Hierarchical multi-attention temporal fusion network module.
Figure 5. Hierarchical multi-attention temporal fusion network module.
Mathematics 13 02872 g005
Figure 6. Models A, B, C, and D obfuscate matrices for AF subtype classification on validation set.
Figure 6. Models A, B, C, and D obfuscate matrices for AF subtype classification on validation set.
Mathematics 13 02872 g006
Figure 7. Training and validation curves for AF subtype classification model.
Figure 7. Training and validation curves for AF subtype classification model.
Mathematics 13 02872 g007
Figure 8. N’ diagram of normal sinus rhythm.
Figure 8. N’ diagram of normal sinus rhythm.
Mathematics 13 02872 g008
Figure 9. Models A, B, C, and D obfuscate matrices for early prediction on the validation set.
Figure 9. Models A, B, C, and D obfuscate matrices for early prediction on the validation set.
Mathematics 13 02872 g009
Figure 10. Training and validation curves for early PAAF prediction model.
Figure 10. Training and validation curves for early PAAF prediction model.
Mathematics 13 02872 g010
Figure 11. Attention weight visualization.
Figure 11. Attention weight visualization.
Mathematics 13 02872 g011
Table 1. Details of the four adopted databases.
Table 1. Details of the four adopted databases.
TaskData SourceSample TypeLabelPatientsSamplesLength
(Points)
Split (Train/Val/Test)
PAAF vs. PEAF Classification
LTAFDBPAAFPAAF314500960 (7.5 s)7200/900/900
LTAFDBPEAFPEAF164500960 (7.5 s)
Early Prediction (≤30 min pre-AF)
LTAFDBNormal rhythm ≤ 30 min pre-AFN’234820960 (7.5 s)14,080/1760/1760
MBAFDBNormal rhythm ≤ 30 min pre-AFN’193980960 (7.5 s)
MBNSRDBHealthy sinus rhythmN188800960 (7.5 s)
Clinical Test
FZU-FPHNormal rhythm ≤ 30 min pre-AFN’-176VariableTest only
FZU-FPHNormal rhythm > 30 min pre-AFN-176Variable
Table 2. Design of specific parameters of the baseline module.
Table 2. Design of specific parameters of the baseline module.
LayersTypeKernelChannelStridActivationOutput
1Input////[960, 1, 2]
2Conv7 × 1321 × 1ReLU[960, 1, 32]
3Pooling4 × 1/2 × 1/[480, 1, 32]
4Conv5 × 1641 × 1ReLU[480, 1, 64]
5Pooling2 × 1/1 × 1/[240, 1, 64]
6Conv3 × 11281 × 1ReLU[240, 1, 128]
7Bi-LSTM 128 Tanh[240, 256]
8FC 64 ReLU[32]
9Output 2 SoftMax[2]
Table 3. Categorical confusion matrix.
Table 3. Categorical confusion matrix.
Prediction
Positive ClassNegative Class
LabelPositive ClassTrue Positive
(TP)
False Negative sample (FN)
Negative ClassFalse Positive sample
(FP)
True Negative sample (TN)
Table 4. Ablation experimental design.
Table 4. Ablation experimental design.
Baseline ModelLead-Level AttentionMorphology-Level AttentionRhythm-Level Attention
Model A///
Model B//
Model C/
Model D
Table 5. Comparison of metric performance of different models for AF subtype classification on the validation set.
Table 5. Comparison of metric performance of different models for AF subtype classification on the validation set.
ModelAccuracyPrecisionRecall F 1
Model A81.66%84.90%81.66%81.23%
Model B86.77%86.97%86.77%86.75%
Model C92.33%92.34%92.33%92.33%
Model D (HMA-TFN)95.66%95.76%95.66%95.66%
Table 6. Comparisons with other relevant studies.
Table 6. Comparisons with other relevant studies.
ApproachMethodsFeatures UsedAccuracyPrecisionRecall F 1
Yang [42]LDAASparse representation of atrial activity spectrum88.82%/95.24%/
Li [43]SVMRR interval-related features91.23%94.23%88.96%91.52%
Singh [44]ANFISRR interval-derived SAV89.33%87.22%89.33%88.26%
Myrovali [45]SAFE ScoreClinical/laboratory parameters 83%80%
Kim [46]CNN-LSTM EnsemblePattern transition features91.26%82.21%95.79%
Kraft [47]1D ConvNeXt V2Single-lead ECG signals 98.6%
Xie [48]CNNPrinted 12-lead ECG during sinus rhythm78.6%87.5%66.7%82.4%
Wang [49]LR + RFMulti-omics data89.2%83%80%-
Raghunath [17]Logistic RegressionCortical biomarkers88%
Duangburong [50]ANFISRR interval-derived SAV89.33%87.22%89.33%88.26%
ProposedHMA-TFARaw dual-lead ECG signals95.77%95.78%95.78%95.77%
Table 7. Comparison of metric performance of different models for early prediction on the validation set.
Table 7. Comparison of metric performance of different models for early prediction on the validation set.
ModelAccuracyPrecisionRecall F 1
Model A90.28%90.39%90.28%90.27%
Model B92.38%93.24%92.38%92.34%
Model C94.26%94.37%94.26%94.25%
Model D95.51%95.56%95.51%95.50%
Table 8. Metric performance of Model D on the test set.
Table 8. Metric performance of Model D on the test set.
LabelSpecificityPrecisionRecall F 1 Accuracy
N93.18%93.33%95.45%94.37%94.31%
N’95.45%95.34%93.18%94.24%
Average94.31%94.34%94.31%94.30%
Table 9. Model of early prediction of paroxysmal atrial fibrillation with other related studies.
Table 9. Model of early prediction of paroxysmal atrial fibrillation with other related studies.
ApproachMethodsForecast PeriodAccuracyPrecisionSpecificityRecall F 1
Hirsch [51]RF30 beats97.40%/96.10%95.90%87.30%
Parsi [52]SVM5 min97.70%/96.70%98.80%/
Tzou [53]Lightweight CNN5 min89.00%/89.00%88.00%88.00%
Elias [22]ResnetBetween 2 months and 1 week//69.33%78.33%/
Petmezas [54]RF, CNN-LSTM, CNN Multihead Attention Model2 weeks//69.00%76.00%/
Lei [55]RF/93.45%/91.40%95.21%/
Cai [17]CNN-LSTM2 weeks/87.37%/83.23%84.99%
ProposedHMA-TFA30 min96.36%96.44%96.36%96.36%96.35%
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Wang, L.-H.; Wang, J.-W.; Xie, C.-X.; Lee, Z.-J.; Cai, B.-J.; Chen, T.-Y.; Chen, S.-L.; Chen, C.-A.; Abu, P.A.R.; Yang, T. Hierarchical Multiattention Temporal Fusion Network for Dual-Task Atrial Fibrillation Subtyping and Early Risk Prediction. Mathematics 2025, 13, 2872. https://doi.org/10.3390/math13172872

AMA Style

Wang L-H, Wang J-W, Xie C-X, Lee Z-J, Cai B-J, Chen T-Y, Chen S-L, Chen C-A, Abu PAR, Yang T. Hierarchical Multiattention Temporal Fusion Network for Dual-Task Atrial Fibrillation Subtyping and Early Risk Prediction. Mathematics. 2025; 13(17):2872. https://doi.org/10.3390/math13172872

Chicago/Turabian Style

Wang, Liang-Hung, Jia-Wen Wang, Chao-Xin Xie, Zne-Jung Lee, Bing-Jie Cai, Tsung-Yi Chen, Shih-Lun Chen, Chiung-An Chen, Patricia Angela R. Abu, and Tao Yang. 2025. "Hierarchical Multiattention Temporal Fusion Network for Dual-Task Atrial Fibrillation Subtyping and Early Risk Prediction" Mathematics 13, no. 17: 2872. https://doi.org/10.3390/math13172872

APA Style

Wang, L.-H., Wang, J.-W., Xie, C.-X., Lee, Z.-J., Cai, B.-J., Chen, T.-Y., Chen, S.-L., Chen, C.-A., Abu, P. A. R., & Yang, T. (2025). Hierarchical Multiattention Temporal Fusion Network for Dual-Task Atrial Fibrillation Subtyping and Early Risk Prediction. Mathematics, 13(17), 2872. https://doi.org/10.3390/math13172872

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop