Abstract
Myocardial infarction (MI) is often complicated by heterogeneous life-threatening conditions, which require outcome-specific risk stratification. Current models typically predict a single composite endpoint and fail to fully exploit inter-patient similarities and temporal dynamics in electronic health records. To address this crucial gap, we present the first graph neural network framework that simultaneously predicts 12 distinct post-MI complications and in-hospital mortality. The model integrates three targeted innovations: first, a density-adaptive K-nearest neighbor graph to capture clinically meaningful patient similarities; second, dual-branch short- and long-term temporal encoders with dynamic gating; and third, cross-modal attention for interactive fusion of multi-scale temporal features. Experiment on a 1700-patient MI complications dataset, our model achieved an average AUC of 0.7330, with a standout 0.8828 for mortality prediction. SHAP analysis and built-in attention weights identified age, serum sodium, and dynamic laboratory trends as top predictors, aligning with clinical knowledge. This interpretable approach offers potential for early, individualized risk assessment in acute cardiac care. Code is available at: https://github.com/WHY-JN/Myocardial-Infarction-GNN
Subject terms: Cardiology, Computational biology and bioinformatics, Diseases, Mathematics and computing, Medical research
Introduction
Cardiovascular diseases (CVDs) represent a leading global health burden, accounting for approximately 20.5 million deaths in 2025, 32% of all global fatalities1. Among these, myocardial infarction (MI) stands out as an acute and life-threatening condition caused by severe or complete coronary artery occlusion, leading to myocardial necrosis2. Many life-threatening complications of MI (e.g., cardiogenic shock, ventricular fibrillation, free-wall rupture, and high-degree atrioventricular block) develop rapidly within the first 72 h of admission3,4. Crucially, most of these events are preceded by subtle deteriorations in vital signs, laboratory trends, or electrocardiographic changes hours to days earlier. Hence, timely identification of patients at high risk of specific complications creates a critical window for targeted preventive interventions (e.g., early mechanical circulatory support, intensified arrhythmia monitoring, prophylactic antiarrhythmic therapy, or urgent imaging). These have been shown to reduce mortality and morbidity when applied pre-emptively significantly. Electronic health records (EHRs) capture these evolving multimodal data continuously5. However, current risk stratification models rely on static admission variables and predict only composite or single endpoints, limiting their ability to guide outcome-specific management.
Research on MI prediction has concentrated on Electrocardiogram (ECG)-based signal analysis, EHR-based modeling, and imaging-based assessment. For example, ECG-based methods predicting MI achieved high diagnostic accuracy on curated waveform cohorts6. However, imaging and ECG approaches primarily focus on acute diagnosis and are not designed to predict mortality or specific post-MI complications. A prevailing limitation of existing research on post-MI prediction is the practice of aggregating diverse complications into a single binary endpoint or predicting mortality alone. While this simplifies the modeling task, it masks substantial differences in pathophysiology, timing, and therapeutic implications across distinct outcomes. For example, Newaz et al. combined resampling and cost-sensitive learning to address severe label imbalance and reported an Area Under Curve (AUC) of 0.8088 for predicting the occurrence of any complication as a single binary outcome7. Furthermore, related works predominantly rely on static admission features or poorly encoded temporal variables, failing to capture multi-scale dynamics (short-term fluctuations versus long-term trends) that often precede clinical deterioration. For instance, Ghafari et al. treated static and temporal variables indiscriminately by applying recursive feature elimination and XGBoost training across all admission features. They achieved an AUC of only 0.7865 for in-hospital mortality and failed to exploit the predictive value of temporal evolution and derived trends8. Moreover, existing studies treat patients as independent entities, completely overlooking inter-patient relational patterns9. However, clinically similar patients often follow comparable trajectories. Therefore, effective post-MI predictive models should simultaneously leverage inter-patient relational patterns, capture multi-scale temporal dynamics, and enable interactive fusion of relational and individual trajectory information, thereby achieving outcome-specific risk stratification, superior discriminative performance, and enhanced clinical interpretability10.
Graph Neural Networks (GNNs) provide a promising approach to address these challenges11. GNNs represent each patient as a node, and the edges signify clinical similarity, allowing the model to learn from both individual trajectories and cohort-level patterns. However, standard GNN implementations in clinical prediction face critical limitations12. First, they typically rely on static graph structures that cannot adapt to evolving patient states. Second, their temporal processing is often monolithic, employing a single encoding strategy that fails to concurrently capture both the rapid, short-term fluctuations and the more subtle, long-term trends present in clinical data. Finally, they lack dedicated fusion mechanisms to integrate these distinct temporal dynamics into a cohesive patient representation before graph-based learning.
To address these limitations, we propose a GNN-based deep learning (DL) model, designed specifically for multi-outcome post-MI risk stratification in this study (see Fig. 1). Our model makes three primary contributions: First, we propose a multi-branch feature engineering model that processes static, short-term, and long-term clinical data in parallel. A key innovation is the integration of dynamic gating mechanisms into our temporal encoders. This allows the model to use high-level feature representations from its convolutional neural network (CNN) and Gated Recurrent Unit (GRU) components to selectively filter and emphasize the most salient patterns in the raw input data, enhancing signal extraction. Second, we designed.
Fig. 1.
The framework of the GraphTransformerNet-based DL model for predicting MI complications and mortality outcomes.
a hierarchical fusion strategy to create a comprehensive patient representation. The multi-scale temporal representations are first integrated using a cross-modal attention mechanism. This unified temporal embedding is then concatenated with the static features before being propagated through a density-adaptive, dynamically constructed patient graph, which leverages a Graph Transformer architecture to model inter-patient relationships effectively. Third, our study is the first to predict distinct post-MI complications in addition to mortality. Through Shapley Additive Explanations (SHAP) analysis and integrated attention weights, we demonstrate that the model provides a high degree of clinical interpretability, validating its alignment with established medical knowledge.
Results
We evaluated the proposed model’s performance in predicting 12 MI complications, with results averaged over 10 runs of fivefold cross-validation (see Table 1). Our model achieved a moderate overall performance, with a mean AUC of 0.7330. The overall recall reached 0.6481, suggesting the model is sensitive to positive cases, this is sharply contrasted by a very low overall mean F1-score of 0.2606. This significant gap between recall and F1-score is a key limitation of our current model. In detail, the model showed its strongest performance in predicting the Lethal outcome with a high AUC of 0.8828 and the most balanced F1-score of 0.6059. However, outcomes including Supraventricular Tachycardia, Dressler Syndrome, Chronic Heart Failure, Recurrent Myocardial Infarction, and Post-Infarction Angina all yielded mean AUCs below 0.70. Additionally, we compared our model against two representative advanced fusion baselines. First, the multimodal Transformer integrates static and temporal admission features through a cross-attention mechanism to enable inter-modal interaction. Second, the heterogeneous GNN models.
Table 1.
Performance of proposed method utilizing admission static and temporal features.
| Outcomes | Mean AUC ± S.D [95% C.I.] |
Mean ACC ± S.D [95% C.I.] |
Mean Recall ± S.D [95% C.I.] |
Mean F1 ± S.D [95% C.I.] |
|---|---|---|---|---|
| Atrial fibrillation |
0.7494 ± 0.029 [0.7287, 0.7701] |
0.7071 ± 0.038 [0.6799, 0.7343] |
0.7110 ± 0.035 [0.6860, 0.7360] |
0.3259 ± 0.028 [0.3059, 0.3459] |
| Supraventricular tachycardia |
0.6085 ± 0.031 [0.5863, 0.6307] |
0.5660 ± 0.045 [0.5339, 0.5981] |
0.4667 ± 0.048 [0.4320, 0.5014] |
0.0409 ± 0.011 [0.0330, 0.0488] |
| Ventricular tachycardia |
0.7536 ± 0.028 [0.7336, 0.7736] |
0.6865 ± 0.041 [0.6572, 0.7158] |
0.5505 ± 0.046 [0.5176, 0.5834] |
0.1435 ± 0.019 [0.1299, 0.1571] |
| Ventricular fibrillation |
0.7552 ± 0.029 [0.7345, 0.7759] |
0.6849 ± 0.040 [0.6563, 0.7135] |
0.6164 ± 0.042 [0.5864, 0.6464] |
0.1932 ± 0.023 [0.1768, 0.2096] |
| Third-degree (Atrioventricular) AV block |
0.8280 ± 0.024 [0.8109, 0.8451] |
0.7648 ± 0.031 [0.7426, 0.7870] |
0.7522 ± 0.032 [0.7293, 0.7751] |
0.2074 ± 0.024 [0.1903, 0.2245] |
| Pulmonary edema |
0.7718 ± 0.027 [0.7525, 0.7911] |
0.7172 ± 0.036 [0.6915, 0.7429] |
0.6602 ± 0.039 [0.6323, 0.6881] |
0.3423 ± 0.029 [0.3216, 0.3630] |
| Myocardial rupture |
0.8103 ± 0.025 [0.7925, 0.8281] |
0.7465 ± 0.033 [0.7229, 0.7701] |
0.7340 ± 0.034 [0.7097, 0.7583] |
0.1597 ± 0.020 [0.1454, 0.1740] |
| Dressler syndrome |
0.6745 ± 0.033 [0.6509, 0.6981] |
0.6521 ± 0.043 [0.6214, 0.6828] |
0.6308 ± 0.041 [0.6015, 0.6601] |
0.1460 ± 0.018 [0.1332, 0.1588] |
| Chronic heart failure |
0.6355 ± 0.035 [0.6105, 0.6605] |
0.6184 ± 0.046 [0.5855, 0.6513] |
0.7081 ± 0.038 [0.6809, 0.7353] |
0.4340 ± 0.032 [0.4110, 0.4570] |
| Relapse of myocardial infarction |
0.6829 ± 0.032 [0.6599, 0.7059] |
0.6551 ± 0.042 [0.6251, 0.6851] |
0.5659 ± 0.045 [0.5338, 0.5980] |
0.2854 ± 0.027 [0.2661, 0.3047] |
| Post-infarction angina |
0.6435 ± 0.034 [0.6192, 0.6678] |
0.6372 ± 0.044 [0.6062, 0.6682] |
0.5999 ± 0.044 [0.5689, 0.6309] |
0.2436 ± 0.025 [0.2258, 0.2614] |
| Lethal outcome |
0.8828 ± 0.021 [0.8678, 0.8978] |
0.8147 ± 0.027 [0.7954, 0.8340] |
0.7811 ± 0.029 [0.7604, 0.8018] |
0.6059 ± 0.026 [0.5873, 0.6245] |
| Proposed model overall performance |
0.7330 ± 0.029 [0.7123, 0.7537] |
0.7254 ± 0.039 [0.6975, 0.7533] |
0.6481 ± 0.040 [0.6195, 0.6767] |
0.2606 ± 0.024 [0.2435, 0.2777] |
| Multimodal transformer |
0.7094 ± 0.031 [0.6872, 0.7316] |
0.6450 ± 0.018 [0.6322, 0.6578] |
0.5647 ± 0.039 [0.5368, 0.5926] |
0.2247 ± 0.024 [0.2076, 0.2418] |
| Heterogeneous GNN |
0.6999 ± 0.021 [0.6849, 0.7149] |
0.6434 ± 0.032 [0.6204, 0.6664] |
0.7227 ± 0.041 [0.6934, 0.7520] |
0.2016 ± 0.035 [0.1766, 0.2266] |
patients, static, and temporal nodes within a heterogeneous graph using type-specific graph attention network-based message passing. From the result, we can see that both baselines achieved lower overall performance compared to our proposed model. Moreover, the Receiver Operating Characteristic (ROC) curves confirm this mixed performance, showing robust discrimination for outcomes like lethal outcomes but highlighting significant challenges in achieving reliable predictions for rarer or less distinct outcomes (see Fig. 2).
Fig. 2.
The ROC-AUC curve of 12 prediction outcomes.
To establish a clinical baseline, we calculated conditional probabilities of death given each complication. Based on this, we defined high-risk outcomes (Myocardial Rupture: 100.00%; Third-degree AV Block: 29.80%; Ventricular Fibrillation: 29.60%; Recurrent Myocardial Infarction: 28.90%; Pulmonary Edema: 25.20%) and selected classification thresholds to achieve at least 0.95 recall, choosing the one with the highest precision. For low-risk outcomes (Supraventricular Tachycardia: 20.00%; Ventricular Tachycardia: 19.00%; Atrial Fibrillation: 18.80%; Chronic Heart Failure: 9.90%; Dressler Syndrome: 4.00%; Post-Infarction Angina: 0.68%), we selected thresholds to maximize the F1-score. For high-risk outcomes critical to clinical decision-making, this method minimized false negatives to ensure the detection of severe complications (see Fig. 3). For high-risk outcomes such as Myocardial Rupture, Third-degree AV Block, and Ventricular Fibrillation, the model achieved complete recall but at the cost of numerous false positives. For the Lethal outcome, the model maintained high recall with moderate false positives, demonstrating clinical relevance in mortality risk detection. For lower-risk complications, thresholds were optimized for the F1-score, achieving a more balanced trade-off between precision and recall.
Fig. 3.
The confusion matrix for the prediction of 12 outcomes.
To quantify the contribution of individual features to model predictions, we conducted SHAP analysis across all outcomes (see Fig. 4.a). We can see age standing out as the most influential factor. Beyond demographic factors, the analysis revealed distinct feature-outcome associations. For instance, the use of anticoagulants (heparin) in the ICU ranked as a primary contributor to ischemic complications, specifically Post-infarction Angina and Relapse of Myocardial Infarction. Moreover, the use of lidocaine exhibited the strongest association with Ventricular Fibrillation. Regarding the Lethal Outcome, top predictors included the presence of essential hypertension and the time elapsed from attack onset to admission. Notably, a derived temporal feature (mean use of opioid drugs in the ICU over 72 h) ranked among the highest contributors to mortality prediction.
Fig. 4.
(a) The global SHAP feature importance analysis (Top 25). (b) The intra-modal heatmap.
Complementing SHAP, we visualized modality-specific attention weights from the short-term gating layer for a high-risk patient (Lethal outcome positive)(see Fig. 4.b). The intra-modal heatmap highlights relative importance across time steps (Day 1–3) and clinical variables, with high weights (> 0.5) indicating critical patterns. These visualizations underscore the model’s ability to capture evolving temporal dynamics, providing actionable clinical insights beyond global feature rankings.
To evaluate the contributions of each component in the proposed DL model, we conducted an ablation study by selectively removing the DA-KNN, Short-term CNN, Long-term GRU, and Cross Models Attention modules from the baseline full model (see Table 2). Removing the cross-modal attention, which integrates short- and long-term temporal signals, reduced the mean AUC from 0.7330 to 0.7071, highlighting its importance in creating a cohesive view of patient trajectories for accurate complication detection. Using only the short-term branch (without Long-term GRU) or long-term branch (without Short-term CNN) yielded AUCs of 0.7165 and 0.7187, respectively, indicating that both scales contribute individually but are most effective together, particularly for capturing subtle clinical deteriorations like progressive renal impairment. Excluding the DA-KNN graph dropped the AUC to 0.7072, underscoring its value in leveraging patient similarities to improve risk estimates for heterogeneous outcomes such as cardiac rupture or arrhythmia. Clinically, these results demonstrate how the full model enhances early identification of high-risk patients, potentially guiding timely interventions and reducing mortality in acute settings.
Table 2.
The result of the ablation study of the proposed DL method.
| Ablation item | Modules | Mean AUC ± S.D. [95% C.I.] | |||
|---|---|---|---|---|---|
| cross model attention | DA-KNN | Long-term GRU | Short-term CNN | ||
| Full model | √ | √ | √ | √ | 0.7330 ± 0.029 [0.7123, 0.7537] |
| – w/o Cross-Attn | × | √ | √ | √ | 0.7157 ± 0.0040 [0.7129, 0.7185] |
| – w/o DA-KNN | √ | × | √ | √ | 0.7072 ± 0.0045 [0.7040, 0.7104] |
| – w/o Long-term GRU | √ | √ | × | √ | 0.7165 ± 0.0039 [0.7137, 0.7193] |
| – w/o Short-term CNN | √ | √ | √ | × | 0.7066 ± 0.0068 [0.7017, 0.7115] |
Discussion
This study introduced a novel GNN-based DL model designed for predicting twelve distinct post-MI complications and mortality. Our approach leverages the complex, evolving nature of clinical data through three targeted methodological innovations: First, intelligently identifying clinically similar patient clusters via density-adaptive graph construction. Second, capturing both fine-grained fluctuations and long-term trends using a dual-branch temporal encoder. Third, synthesizing these multi-dimensional features through a cross-modal attention mechanism. Our model achieved an average AUC of 0.7330 across 12 outcomes, with a standout 0.8828 for mortality. By moving beyond simple binary classification, this framework offers a potential foundation for pre-emptive therapeutic interventions during the critical first 72 h of admission..
To contextualize our model’s performance, we compared it with recent studies that employed the same dataset for predicting post-MI mortality and complications. This is the first GNN-based framework for this task, extending predictions from binary to 12 distinct outcomes. For mortality prediction, the AUC score of our model significantly outperforms Ghafari et al. (AUC = 0.7865) and Newaz et al. (AUC = 0.8088)7,8. This validates that explicitly modeling temporal evolution and latent patient similarities yields superior prognostic power compared to static approaches. While Satty et al. reported a higher AUC (0.901), their methodology lacked rigorous multi-fold cross-validation and relied on aggressive imputation strategies that may introduce look-ahead bias, leading to over-optimistic estimates that are difficult to replicate in clinical practice13. Moreover, Vicente et al. reported strong performance metrics (e.g., F1-score = 0.912)14. However, the omission of AUC precludes a complete assessment of discriminative ability under severe class imbalance. For complication prediction, while Khamis et al. reported an AUC of 0.992, their formulation aggregates heterogeneous complications into a single binary endpoint9. This approach obscures prognostic heterogeneity and limits clinical interpretability. In contrast, our model explicitly predicts twelve distinct complications by dynamically integrating inter-patient relational patterns with intra-patient dynamics. This is essential for clinical decision-making, where interventions differ substantially between disparate conditions.
A primary obstacle to the clinical implementation is the interpretation of the DL model’s decision-making process to clinicians. Our interpretability analysis confirms that the proposed model transcends simple association mapping by learning to interpret the context of care. The high attribution of pharmacological interventions suggests that the network effectively utilizes therapeutic actions as proxies for phenotypic severity. By weighting variables such as anticoagulant or antiarrhythmic usage, the model infers physiological instability that may not be explicitly captured in sparse vital sign logs. This ability to decode the trajectory of therapeutic interventions indicates that the model assesses risk dynamically, reflecting the patient’s responsiveness to ongoing treatment. Furthermore, the prominence of derived temporal features among the top predictors provides strong validation for our multi-scale temporal encoding strategy. It demonstrates that clinically relevant signals are often embedded in the cumulative evolution of patient status rather than in isolated raw measurements. Additionally, the intra-modal attention mechanism translates these technical capabilities into actionable clinical utility. In practice, it enables clinicians to rapidly discern the reason for a high-risk alert, thereby supporting outcome-specific therapeutic adjustments in the critical post-admission window.
This study has several limitations. First, our analysis relies on a single-center dataset, which encodes demographic distributions and treatment preferences. Consequently, the patient similarity graph learned here may not fully generalize to populations with different genetic backgrounds or healthcare systems with divergent resource availability, introducing potential selection bias and dataset shift during cross-site deployment. Second, the F1-score of our model was relatively low, reflecting challenges in balancing precision and recall under severe class imbalance. Although focal loss, class weighting, and stratified cross-validation were employed, residual imbalance affected overall performance, particularly for rare outcomes with AUCs below 0.70. Conventional resampling methods like SMOTE risk generating clinically implausible profiles in multi-label EHR settings, limiting their applicability here. Third, the multi-label prediction across 12 complications yielded moderate AUC, influenced by positive case scarcity and outcome heterogeneity. Finally, we utilize structured EHR data exclusively. The absence of waveform data (e.g., raw ECG signals, echocardiography videos) represents a missed opportunity to capture subtle phenotypic nuances that often precede clinical deterioration.
Future research will address these limitations in several directions. First, external validation on multi-center cohorts will be conducted to evaluate generalizability across diverse demographics and healthcare settings. Second, advanced imbalance-handling techniques, such as multi-label focal loss variants or clinically constrained generative augmentation, will be explored to improve F1-scores for rare complications. Third, the framework will be extended to multimodal inputs by incorporating waveform signals (ECG) and imaging data, potentially. Fourth, for clinical application, the model’s low computational requirements will be leveraged to facilitate deployment in resource-constrained environments. Notably, inference can be performed efficiently on standard CPU hardware without GPU acceleration. This meeting essential conditions for real-time integration into hospital EHR systems as automated risk alerting tools that prompt proactive interventions in MI care.
Methods
Myocardial infarction complications dataset
The Myocardial infarction complications were utilized for this study15, which included clinical records from 1,700 patients diagnosed with acute MI (see Table 3). It comprises 111 clinical feature variables and 12 complication outcomes (binary indicators for complications and a categorical variable for lethal outcomes)16. The feature variables include demographic information, medical history, laboratory values, electrocardiographic findings, and treatment details.
Table 3.
Baseline characteristics of the MI complications dataset.
| Characteristic | Value/Description |
|---|---|
| Admission Features | 102 |
| Dynamic Features | 9 (Days 1, 2, 3) |
| Mean Age (years) | 61.86 (std: 11.26) |
| Gender Distribution | Male: 62.65%, Female: 37.35% |
| Missing Percentage | Overall percentage: 8.47% |
| Input Variables | 111 static features and 9 temporal features |
| Target Variables: Complications | Atrial Fibrillation: 170 cases (10.00%); Supraventricular Tachycardia: 20 cases (1.18%); Ventricular Tachycardia: 42 cases (2.47%); Ventricular Fibrillation: 71 cases (4.18%); Third-degree AV block:57 cases (3.35%); Pulmonary Edema: 159 cases (9.35%); Myocardial Rupture: 54 cases (3.18%); Dressler Syndrome: 75 cases (4.41%); Chronic Heart Failure: 394 cases (23.18%); Recurrent Myocardial Infarction: 159 cases (9.35%); Post-Infarction Angina: 148 cases (8.71%); |
| Target Variable: Lethal outcome | Survival:1429 patients (84.06%); Cardiogenic shock :110 patients (6.47%); Pulmonary edema: 18 patients (1.06%); Myocardial rupture: 54 patients (3.18%); Progress of CH: 23 patients (1.35%); Thromboembolism: 12 patients (0.71%); Asystole: 27 patients (1.59%); Ventricular fibrillation: 27 patients (1.59%) |
The dataset is preprocessed in four steps. First, missing entries of feature variables are filled with the median value of each column. Second, temporal features are derived by computing pairwise differences (day2-day1, day3-day2, day3-day1), mean values, and linear regression slopes across 72 h’ measurements. Third, all continuous features underwent standardization to z-scores to ensure scale consistency. Finally, due to the severe class imbalance of the dataset and guided by clinical interventions, we opted for the Lethal outcome for binarization.
Design of the GNN-based model
We developed a GNN-based model to predict twelve MI complications and mortality from heterogeneous EHR data (see Fig. 1). The model first constructs a patient similarity graph, extracts multi-scale temporal features from raw and derived time series, fuses these features interactively, and then performs relational propagation via graph transformer layers followed by a fully connected output layer for multi-label classification12.
The design incorporates three targeted innovations:
Density-adaptive K-Nearest Neighbor (DA-KNN) graphs. The model utilizes a graph structure where patients are represented as nodes linked via cosine similarity. By dynamically adjusting the neighborhood size k relative to local density, the framework effectively leverages cohort-level manifold structures for individualized risk estimation.
Multi-scale temporal encoding. We decompose raw time-series data into short-term local patterns and long-term dependencies using dynamic gated CNNs and gated GRUs, respectively. This architecture enhances the capture of evolving physiological dynamics (e.g., distinct daily variations in serum sodium), facilitating early complication detection.
Cross-modal attention for fusion. To synthesize temporal information, short- and long-term embeddings are fused via a multi-head attention mechanism. This facilitates interactive feature refinement across scales, thereby augmenting the model’s discriminative capacity and providing interpretability via attention weight analysis.
Density-adaptive optimized K-nearest neighbour (DA-KNN) Graphs
To capture patient similarities while accounting for the uneven distribution of clinical phenotypes, we construct a dynamic graph using a density-adaptive strategy17(see Fig. 5a). Unlike static k-NN approaches that force a fixed number of neighbors, DA-KNN adjusts connectivity based on the local density of the patient manifold. First, pairwise similarities are computed via cosine similarity. To filter noise while preserving connections in sparse regions (often representing rare complications). Starting with a base threshold
, we compute an adjusted threshold
:
![]() |
1 |
where
denotes he average similarity of the batch. The neighborhood size
for each patient i is dynamically scaled relative to its local density
(estimated by averaging the similarities of the top-5 neighbors):
![]() |
2 |
where
and
are the minimum and maximum densities across all patients. We set
and
. This ensures that patients in sparse regions retain minimal connectivity to prevent graph fragmentation, while those in dense regions utilize richer neighborhood information for robust risk estimation.
Fig. 5.
(a) Construction of a density-adaptive patient similarity graph. (b) Extraction of short-term temporal embeddings via CNN and dynamic gating. (c) Modeling long-term temporal trends with GRU and dynamic gating.
Multi-scale temporal encoding with dynamic gating
To accurately capture the evolving physiological status of MI patients, our model employs a dual-stream architecture. This design enables our model to simultaneously extract fine-grained fluctuations from raw measurements and gradual systemic trends from derived features.
The Short-term CNN branch processes raw temporal features using a 1D convolutional network with alternating kernel sizes (2 and 4) to detect local changes18 (see Fig. 5b). A dynamic gating layer filters measurement noise and missing-value artefacts common in EHRs. The gating vector
is computed to modulate the information flow:
![]() |
3 |
Here, the gating vector g functions as a learned filter that controls the flow of information from the raw input
. First, it considers the raw input sequence itself, processed through a linear projection
. Second, it incorporates the feature representation h learned by the preceding convolutional layers, which is also linearly projected via
. Finally, it models their non-linear interaction by passing the element-wise product of the input
and another projected version of the feature representation
through a small multi-layer perceptron (MLP). The resulting components are summed and passed through a sigmoid activation function σ, which normalizes the output g to a range between 0 and 1. When multiplied element-wise (⨀) with the original input, this gating vector g acts as a series of soft switches: it learns to amplify clinically important patterns by assigning them values close to 1, while suppressing irrelevant noise or artifacts from missing data by assigning them values close to 0. The final short-term embedding is derived from this modulated input (
⨀ g), ensuring that the model prioritizes the most salient clinical signals.
The Long-term GRU branch is implemented as a single-layer GRU with a hidden size of 6419. This unit is designed to process derived temporal trend features (including pairwise differences, means, and linear slopes computed across the 72-h observation period, totaling 16 dimensions) (see Fig. 5c). The dynamic gating mechanism described in the SHORT-TERM CNN is applied (Eq. 3), with the GRU hidden state serving as the conditioning vector
(initial
= 0). The gated input is then passed to the GRU.
The final GRU hidden state (64-dimensional) is used as the long-term embedding. This design selectively retains clinically stable trends (e.g., progressive decline over 72 h) while suppressing noise-induced variability.
Cross-Modal attention for adaptive fusion and interpretability
To enable dynamic interaction between the short-term embedding
and the long-term embedding
. We introduce a cross-modal attention mechanism based on multi-head attention20. The
serves as the query, and the
provides both the keys and values. This configuration allows the model to learn which aspects of the long-term trends are most relevant for refining the representation of short-term patterns. The fused embedding is then obtained through residual integration and normalization:
![]() |
4 |
The attention weights derived from this process also offer a valuable source of interpretability, highlighting which temporal scales the model focuses on when making a prediction. Additionally, intra-modal attention is embedded within the dynamic gating layers of both Short-term CNN and Long-term GRU. For a given input
and hidden state
, the attention score is computed as:
![]() |
5 |
where
and
are learnable transformations. These scores highlight salient features or time steps, visualized as heatmaps to enhance model interpretability.
Experimental setup
To ensure the robustness and statistical validity of our results, we evaluated all models using a rigorous experimental protocol. This protocol consisted of 10 independent runs, each employing a fivefold stratified cross-validation strategy (StratifiedKFold) for data splitting to ensure fair comparison across all runs and models. Training was limited to 300 epochs with a batch size of 64. We employed the AdamW optimizer (learning rate: 1e-3, weight decay: 2e-3) with a ReduceLROnPlateau scheduler (factor: 0.5, patience: 15). The Focal Loss was used as the objective function (α = 0.5, γ = 2.0, label smoothing: 0.05), with positive class weights adjusted per fold to address class imbalance21. All experiments were conducted on Kaggle using a single GPU (P100 16 GB). Model performance was assessed using metrics including AUC, accuracy, F1-score, and recall (from sklearn.metrics). Given the significant class imbalance in the dataset, we prioritized AUC as the primary validation metric, which can be calculated as:
![]() |
6 |
where
and
,
denoting infinitesimal changes in the false positive rate.
Conclusion
In this study, we developed a GNN-based model to simultaneously predict in-hospital mortality and distinct complications in patients with myocardial infarction. By integrating density-adaptive graph construction, dual-branch dynamic gating, and cross-modal attention, our model effectively addresses the limitations of static patient modeling and monolithic temporal processing observed in existing approaches. The model achieved robust performance, particularly for mortality prediction, and demonstrated superior outcome-specific stratification compared to baseline methods. Crucially, SHAP and attention-based interpretability analysis revealed that the model captures clinically meaningful signals. While challenges regarding class imbalance for rare complications persist, this study lays the groundwork for integrating heterogeneous EHR data into clinical workflows. For example, real-time risk alerts that trigger timely interventions, including intensified monitoring or mechanical support, in acute cardiac settings.
Acknowledgements
This work was supported by the Jining City of Science and Technology Bureau (Key research and development project: 2024YXNS022).
Author contributions
D.G. and D.Z. conceived the study and conducted the experiments. D.G. performed data analysis and figure generation. Z.Z., F.M., Y.C., and H.W. provided supervision and resources. All authors reviewed the manuscript.
Funding
This work was funded by the Jining City of Science and Technology Bureau (Key research and development project: 2024YXNS022).
Data availability
The Myocardial Infarction Complications dataset used in this study is publicly available from https://archive.ics.uci.edu/dataset/579/myocardial+infarction+complications.
Declarations
Competing interests
The authors declare no competing interests.
Footnotes
Publisher’s note
Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
References
- 1.Chong, B. et al. Global burden of cardiovascular diseases: projections from 2025 to 2050. Eur. J. Prev. Cardiol.32, 1001–1015. 10.1093/eurjpc/zwae281 (2025). [DOI] [PubMed] [Google Scholar]
- 2.Thygesen, K. et al. Fourth universal definition of myocardial infarction (2018). Eur. Heart J.40, 237–269. 10.1093/eurheartj/ehy462 (2019). [DOI] [PubMed] [Google Scholar]
- 3.Reed, G. W., Rossi, J. E. & Cannon, C. P. Acute myocardial infarction. Lancet389, 197–210. 10.1016/S0140-6736(16)30677-8 (2017). [DOI] [PubMed] [Google Scholar]
- 4.Kaczorowski, D. J. et al. American association for thoracic surgery (AATS) expert consensus document: surgical management of acute myocardial infarction and associated complications. J. Thorac. Cardiovasc. Surg.10.1016/j.jtcvs.2025.04.013(2025) (2025). [DOI] [PubMed] [Google Scholar]
- 5.Ghafari, R. et al. Prediction of the fatal acute complications of myocardial infarction via machine learning algorithms. JTHC10.18502/jthc.v18i4.14827 (2024). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 6.Saranya, P. & Vennila, C. Myocardial infarction detection using variational mode decomposition with Fuzzy weight particle swarm optimization and depthwise separable convolutional network. Comput. Biol. Med.193, 110329. 10.1016/j.compbiomed.2025.110329 (2025). [DOI] [PubMed] [Google Scholar]
- 7.Newaz, A., Mohosheu, M. S. & Al Noman, M. A. Predicting complications of myocardial infarction within several hours of hospitalization using data mining techniques. Inform. Med. Unlocked42, 101361. 10.1016/j.imu.2023.101361 (2023). [Google Scholar]
- 8.Ghafari, R. et al. Prediction of the fatal acute complications of myocardial infarction via machine learning algorithms. J. Tehran Heart Cent18, 278–287. 10.18502/jthc.v18i4.14827 (2023). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 9.Khamis, G. S. M. et al. Prediction of myocardial infarction complications using gradient boosting. Eng, Technol. Appl. Sci. Res.14, 18550–18556. 10.48084/etasr.9076 (2024). [Google Scholar]
- 10.Oss Boll, H. et al. Graph neural networks for clinical risk prediction based on electronic health records: A survey. J. Biomed. Inform.151, 104616. 10.1016/j.jbi.2024.104616 (2024). [DOI] [PubMed] [Google Scholar]
- 11.Alrashdi, I. & Taloba, A. I. Integration of graph neural networks and long short-term memory models for advancing heart failure prediction. Alex. Eng. J.127, 143–163. 10.1016/j.aej.2025.05.014 (2025). [Google Scholar]
- 12.Yun, S., Jeong, M., Kim, R., Kang, J. & Kim, H. J. Graph transformer networks. In advances in neural information processing systems Vol. 32 (Curran Associates Inc., 2019). [Google Scholar]
- 13.Satty, A. et al. Comparative analysis of machine learning algorithms for investigating myocardial infarction complications. Eng. Technol. Appl. Sci. Res.14, 12775–12779. 10.48084/etasr.6691 (2024). [Google Scholar]
- 14.Vicente, A. L. G., Junior, R. D. M. & Romero, R. A. F. Explainable LightGBM Approach for Predicting Myocardial Infarction Mortality. In 2023 International Conference on Computational Science and Computational Intelligence (CSCI) 323–328, 10.1109/CSCI62032.2023.00057 (2023).
- 15.Golovenkin, S.E., Shulman, V. A., Rossiev, D. A., Shesternya, P.A., Nikulina, S.Yu., Orlova, Yu. V. & Voino-Yasenetsky, V.F. Myocardial infarction complications. 10.24432/C53P5M. (2020).
- 16.Golovenkin, S. E. et al. Trajectories, bifurcations, and pseudo-time in large clinical datasets: applications to myocardial infarction and diabetes data. GigaScience9, giaa128. 10.1093/gigascience/giaa128 (2020). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 17.Li, J., Shyr, Y. & Liu, Q. aKNNO: single-cell and spatial transcriptomics clustering with an optimized adaptive k-nearest neighbor graph. Genome Biol25, 203. 10.1186/s13059-024-03339-y (2024). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 18.Elyamani, H. A., Salem, M. A., Melgani, F. & Yhiea, N. M. Deep residual 2D convolutional neural network for cardiovascular disease classification. Sci Rep14, 22040. 10.1038/s41598-024-72382-3 (2024). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 19.Cho, K. et al. Learning phrase representations using RNN encoder–decoder for statistical machine translation. In: Proceedings of the 2014 Conference on Empirical Methods in Natural Language Processing (EMNLP) 1724–1734 (Association for Computational Linguistics, Doha, Qatar), 10.3115/v1/D14-1179 (2014).
- 20.Vaswani, A. et al. Attention is all you need. In: Proceedings of the 31st International Conference on Neural Information Processing Systems 6000–6010 (Curran Associates Inc., Red Hook, NY, USA, 2017).
- 21.Lin, T.-Y., Goyal, P., Girshick, R., He, K. & Dollar, P. Focal Loss for Dense Object Detection. IEEE Trans. Pattern Anal. Mach. Intell.42, 318–327. 10.1109/TPAMI.2018.2858826 (2020). [DOI] [PubMed] [Google Scholar]
Associated Data
This section collects any data citations, data availability statements, or supplementary materials included in this article.
Data Availability Statement
The Myocardial Infarction Complications dataset used in this study is publicly available from https://archive.ics.uci.edu/dataset/579/myocardial+infarction+complications.











