1. Introduction
The proliferation of electronic health records (EHRs) in recent years has resulted in an unprecedented accumulation of clinical data, encompassing patient interactions, events, and interrelated medical information. The growing availability of such datasets enables predictive modeling to support risk mitigation, optimize clinical workflows, and enhance patient care across multiple domains, including diagnosis [
1,
2], medication management [
3], and procedural interventions [
4,
5]. Despite this potential, the deployment of predictive models in clinical settings remains constrained by the need for high precision and the complete integration of patient histories, among other challenges associated with heterogeneous, multi-source data [
6].
Graph representation learning offers a compelling approach for capturing the complex relationships inherent in EHR data [
7]. Graph neural networks (GNNs) can model both local and global dependencies among diverse clinical entities, including patient histories, diagnoses, medications, and procedures, through non-linear message-passing operations. These capabilities have been shown to improve predictive performance across tasks ranging from disease onset prediction to drug recommendation. Nonetheless, practical applications are often hampered by data heterogenity, fragmentation, and the sequential nature of patient histories, which, in turn, reduce representation quality [
8], highlighting the need for unified frameworks that integrate temporal, multimodal, and graph-structured representations of patient data.
Existing approaches, a summary of which is provided in
Table 1, remain particularly fragmented across tasks, input modalities, and time-dependent feature learning. Firstly, most existing approaches are task-specific with limited ability to learn generalizable representations. Secondly, many methods rely predominantly on codified data, with only a subset incorporating numerical features or clinical text, thus resulting in incomplete patient representations and under-utilization of available EHR modalities. Thirdly, while models capture temporal dependencies through sequential signals, they lack the ability to fully model complex interactions among diversified clinical events over time. Moreover, although recent works introduce graph-based components, they often use simplified or partially integrated graph structures without fully leveraging the structure-rich nature of patient health knowledge graphs for joint relational and temporal reasoning. Lastly, minimal attention has been paid to quantifying the uncertainty in model predictions, a key reliability requirement for practical clinical settings.
To address these limitations, in this work, we propose a modular framework that is end-to-end trainable for prediction across multiple tasks using a heterogeneous patient health knowledge graph (PHKG). We focus on patients at the onset of heart failure (HF) and apply our model for three individual tasks, namely HF diagnosis, mortality risk, and readmission rate prediction. These classification tasks are critical for downstream clinical processes; however, they are particularly difficult to predict due to high levels of comorbidity and weak correlations in data. The proposed approach, a Sequential Graph Neural Network (SeqGNN), captures the hidden structures from patient graphs and subsequently models temporal dependencies across visits for multiple downstream tasks via:
A multi-type graph encoder generates contextualized embeddings in order to support the integration of numerical, textual, and codified information.
A configurable sequential decoder, equipped with a learnable temporal component, in order to capture the longitudinal progression of clinical events across patient visits.
A sequence-based predictor that supports (binary or multi-label) classification across different clinical tasks given fully integrated data as patient health knowledge graphs.
Uncertainty quantification in order to provide insights into model performance related to HF predictive tasks through ensemble SeqGNN predictors.
Our approach is guided by three key research questions aimed at understanding both the behavior and design of SeqGNN models for clinical prediction tasks. Firstly, we analyze which components of sequential and longitudinal EHR modeling—such as temporal learning, multimodal data integration, and structural representations—most effectively inform model design for individual diagnosis, readmission, and mortality prediction tasks (RQ1). Secondly, we examine what uncertainty quantification and calibration analyses reveal about these models, with a focus on understanding their reliability, stability, and limitations across different clinical settings (RQ2). Thirdly, we investigate to what extent the relationship between prediction confidence and performance in ensemble SeqGNNs can inform model deployment, particularly in practical settings, identifying reliable predictions, limitations, and refinement strategies for future research (RQ3).
More specificaly, we construct a visit-centric PHKG from an electronic health record repository to model heart-failure-related outcomes. Hospital admissions are first filtered to retain only clinically confirmed HF cases using predefined ICD-9 codes. For each qualifying admission, four structured clinical domains are extracted: medications, abnormal laboratory measurements, procedures, and HF-specific diagnoses. Duplicates and incomplete entries are removed to ensure a consistent admission-level representation. Each admission is treated as a distinct visit node connected to its associated clinical concept nodes (medications, labs, procedures, diagnoses), forming heterogeneous, multi-relational subgraphs. Identical clinical concepts across admissions are represented by shared global nodes, enabling parameter sharing and cross-visit generalization when all admission-level subgraphs are merged into a single global PHKG.
To support sequential modeling, visits are grouped by patient identifier and ordered chronologically using admission timestamps, forming variable-length visit sequences per patient. Each visit retains its admission-level label (mortality, readmission, or multi-label HF phenotype). The graph structure models intra-visit clinical relationships, while the ordered visit sequences enable longitudinal learning across time. This design allows a sequential GNN framework to first encode each visit via message passing over the PHKG and subsequently model temporal dependencies across visits.
For node feature generation, concept nodes are enriched using both semantic and numerical representations. Textual descriptions of medications, laboratory findings, and procedures are encoded with a pre-trained sentence transformer, producing dense embeddings attached with concept nodes. For laboratory concepts, raw scalar values are additionally projected into vector space using a small feed-forward network and concatenated with text embeddings, preserving precise quantitative information. Visit nodes receive learnable embeddings and aggregate semantic signals implicitly through message passing rather than explicit feature pooling at construction time. This node-centric enrichment strategy yields a semantically expressive, numerically grounded heterogeneous PHKG suitable for sequential graph neural network modeling of heart failure prediction tasks.
Our evaluation considers three sequential prediction tasks derived from hospital admissions as binary classification problems: in-hospital mortality, readmission within a specified time frame, and heart failure diagnosis prediction. Tasks leverage chronological visit sequences processed by the graph encoder followed by the sequential decoder, enabling the model to integrate relational and temporal information effectively. We evaluate the model on the publically available MIMIC III dataset (accessed 13 March 2026 via:
https://physionet.org/content/mimiciii/1.4/) including hospitalizations in an intensive care unit, in terms of the area under receiver operating (AUROC) and precision–versus–recall curves (AUPRC) as compared to the-state-of-the-art methods. In order to measure the applicability of the proposed method in real-world settings, we further conduct uncertainty quantification (UQ) experiments and show that with an increasing number of ensemble SeqGNNs, high-confidence predictions can be made in each task.
2. Patient Health Knowledge Graphs
Clinical information such as patient visits, diagnoses, medications, laboratory measurements, and procedures, are derived from hospital admissions. Each hospital admission is treated as a distinct clinical event and linked to a unique patient identifier, enabling the construction of longitudinal patient trajectories. The dataset is preprocessed to ensure consistency between admission records and encoded clinical entities, and subsequently transformed into a PHKG, where nodes represent clinical concepts and visits, and edges capture their relationships. This representation supports both relational modeling across heterogeneous medical entities and sequential modeling of chronologically ordered patient visits for downstream prediction tasks, as detailed in the following subsections.
2.1. Dataset
We use the MIMIC repository containing tabular data for patients to ultimately generate triples that form a PHKG for training and evaluation purposes. All records for a set of patients are extracted according to predefined criteria. The criteria by which the records are obtained include the intent for hospitalization, table names and concepts, as well as entity types and relations. The intent for hospitalization can be set in order to limit the scope of the task to a particular use case. In this work, records from patients that are hospitalized for heart failure (HF) are separated based on their ICD codes (i.e., International Classification of Diseases). Since many tables already exist as data sources for patients with a particular hospitalization intent, the scope is further narrowed down to main concepts related to any medication prescribed, lab results and measurements taken, hospital procedures performed, and diagnoses made. The relevant data are stored in separate tables and can be processed as such (please refer to
Figure 1). Within each table, a subset of columns and relations is selected by examination as explained in subsequent sections. While the dataset is provided in two versions, in this study, the following versions is utilized:
MIMIC III—The first version of the repository that we use contains data associated with 53,423 distinct hospital admissions for adult patients (aged 16 years or above) admitted to critical care units between 2001 and 2012 covering 38,597 distinct adult patients overall. The median age of adult patients is 65.8 years, 55.9% patients are male, and in-hospital mortality is 11.5%. In addition, it contains data for 7870 neonates admitted between 2001 and 2008 (excluded from this study). The median length of an ICU stay is 2.1 days and the median length of a hospital stay is 6.9 days. A mean of 4579 charted observations (‘chartevents’) and 380 laboratory measurements (‘labevents’) are available for each hospital admission.
Figure 1.
MIMIC III tables used in this study and connections through a foreign key.
Figure 1.
MIMIC III tables used in this study and connections through a foreign key.
We utilize admission-level information from the admission table, which provides patient identifiers, admission and discharge timestamps, in-hospital mortality indicators, and primary diagnosis descriptions. Clinical events associated with each hospital admission are retrieved from four primary tables: ICD-9 diagnosis codes, ICD-9 procedure codes, medication orders including drug names, National Drug Codes (NDC), and dosage information, and laboratory measurements. For each admission, structured codes are extracted and filtered to remove missing or duplicate entries (medications without NDC codes and laboratory records without measurements). The resulting admission-level representation includes diagnosis codes, procedure codes, medication identifiers, and laboratory-item identifiers, together with numerical laboratory values stored as literals. This preprocessing step yields a consistent, admission-centric dataset that supports both relational graph construction and longitudinal patient-level modeling.
More precisely and as shown in
Figure 1, the
PATIENTS table provides demographic information (e.g., age, gender, date of death) linked via
subject_id, while
ADMISSIONS defines hospital visits using
hadm_id and includes key outcome variables such as
hospital_expire_flag, admission and discharge timestamps, and admission type. Diagnostic and procedural information is recorded in
DIAGNOSES_ICD and
PROCEDURES_ICD, respectively, using ICD-9 codes associated with each admission. Medication administrations are extracted from
PRESCRIPTIONS, which provides drug names and dosage details. The
D_ICD_DIAGNOSES table serves as the reference dictionary for ICD-9 diagnosis codes in MIMIC-III. Laboratory measurements are obtained from
LABEVENTS, including numeric results, abnormality flags, and timestamps, with metadata definitions available in
D_LABITEMS. Together,
subject_id and
hadm_id form the relational backbone of the database, enabling the construction of admission-centric heterogeneous graphs for mortality prediction, readmission modeling, and heart failure outcome analysis.
Heart failure admissions were identified by scanning diagnosis records for the presence of any of the ICD-9 codes listed in
Table 2. These codes collectively capture the full range of heart failure phenotypes, including acute, chronic, systolic, diastolic, and unspecified forms. Every hospital admission containing at least one of these codes was retained for graph construction, ensuring that only clinically confirmed heart failure episodes entered the final dataset. In total, 10,154 unique patients were included with one or more heart-failure diagnosis. We included all visits related to a patient with heart-failure diagnosis for a total 13,608 admissions. These admissions include 1192 unique procedure codes, 15 unique diagnosis codes, 265 unique lab item codes, and 3498 unique medication codes. Further statistics related to the dataset utilized in this study are shown in
Table 3.
2.2. Classification Tasks
Labels for downstream prediction tasks are derived directly from structured fields within the MIMIC-III database at the hospital admission level. All tasks are formulated at the visit level and subsequently organized into chronological patient sequences for sequential modeling. For all tasks, admission-level labels are grouped by patient identifier and ordered chronologically using admission timestamps. This results in variable-length visit sequences per patient. During model training, sequences are padded to a uniform length and accompanied by masking vectors to ensure that loss computation and evaluation metrics are applied only to valid visits. The classification sequences and labels for each task are extracted as follows:
Heart Failure Diagnosis—Heart failure diagnosis labels are derived from the
DIAGNOSES_ICD table. For each hospital admission, all ICD-9 diagnosis codes are examined, and the presence of any HF-specific codes listed in
Table 2 is recorded. Unlike mortality and readmission, HF diagnosis prediction is formulated as a multi-label classification task: each admission may contain multiple HF-related ICD-9 codes simultaneously. A binary indicator vector is constructed per admission, where each dimension corresponds to one HF ICD-9 code, taking value 1 if the code is present and 0 otherwise. This produces a structured multi-label representation aligned with the admission-level graph nodes. For each index admission, subsequent admissions within a 365-day window are examined to determine whether a heart-failure diagnosis code appears. If a predefined heart-failure code is observed during a future admission within the specified window, the index admission is labeled as positive. Patients with fewer than two admissions are excluded because the occurrence of future heart failure cannot be determined. Using the full MIMIC-III dataset, 20,676 heart HF diagnosis records corresponding to 13,608 unique admissions were found. Importantly, during experiments for this task, the labeled data are excluded from the original PHKG using the test set.
In-Hospital Mortality—In-hospital mortality labels are obtained from the admission table using the hospital_expire_flag field. This binary indicator takes value 1 if the patient died during the hospital stay and 0 otherwise. Each hospital admission is therefore assigned a single binary mortality label. For sequential modeling, mortality labels are aligned with their corresponding admission timestamps and ordered chronologically per patient. Because the outcome occurs within the same hospital stay, label construction does not require information from subsequent admissions. Consequently, patients with a single recorded admission can be included in this task.
As shown in
Figure 2, mortality rates varied across codes, with the highest rates observed for 4289 (30.8%) and 4281 (21.7%), although these codes occurred in relatively small numbers of admissions (13 and 23, respectively). The most prevalent code, 4280 (congestive heart failure unspecified), appeared in 13,111 admissions and had a mortality rate of 14.4%, reflecting its broad use in clinical coding. Most other HF subtypes showed mortality rates between 8.8% and 13.7%, indicating moderate variation across HF diagnoses. Correlation analysis between the presence of individual HF codes and mortality revealed very weak associations overall, with small positive correlations for 4289 (
) and 4281 (
), while most codes showed slightly negative correlations, such as 42,822 (
) and 42,832 (
). These results suggest that individual HF ICD-9 codes alone have limited predictive value for in-hospital mortality, although rare or unspecified HF codes appear to be associated with somewhat higher observed mortality rates.
Hospital Readmission—Hospital readmission is defined as a binary outcome indicating whether a patient is readmitted within a predefined temporal window following discharge (e.g., 30 days). For each admission, the discharge timestamp (dischtime) is compared to the admission time (admittime) of the next hospitalization for the same patient. If the time difference falls within the specified threshold, the current admission is labeled as a positive readmission case. The final admission of each patient sequence is excluded from readmission labeling, as no subsequent visit exists for comparison. This procedure yields one binary readmission label per admission. Labels are generated by examining the time difference between consecutive admissions for the same patient. Admissions resulting in in-hospital death are excluded from this task because readmission cannot occur in such cases. Since the label depends on the presence of a subsequent admission, only patients with at least two admissions are retained.
Overall, as shown in
Figure 2, readmission rates were relatively low (generally between 2% and 8%), with the highest rates observed for ICD-9 code 42,843 (7.65%) and 42,823 (7.61%), followed by 42,842 (6.70%) and 42,832 (6.05%). These findings suggest that certain HF subtypes are associated with slightly higher short-term readmission risk. The most common code, 4280 (congestive heart failure unspecified), appeared in 13,111 admissions and had a readmission rate of 4.30%, reflecting its broad clinical use. Correlation analysis between the presence of individual HF codes and 30-day readmission showed generally weak associations, with the strongest positive correlations observed for 42,823 (
), 42,832 (
), and 42,843 (
). Several codes showed near-zero or slightly negative correlations (e.g., 42,821,
). Overall, these results suggest that HF ICD-9 codes alone provide limited predictive power for short-term readmission, although certain acute or more specific HF subtypes exhibit slightly stronger associations with readmission risk.
2.3. Patient Health Knowledge Graph Construction
To enable graph neural network modeling of heart failure outcomes, we construct a collection of visit-centric heterogeneous Patient Health Knowledge Graphs (PHKGs) derived exclusively from heart-failure hospitalizations explained above. The objective is to represent each admission as a structured, multi-relational graph that preserves both clinical semantics and relational topology. Let P denote the cohort of patients. For each patient , define , , , and as the sets of laboratory observations, diagnoses, medications, and procedures, respectively. The complete set of encoded clinical concepts is given by: . Visits are chronologically ordered as , where each visit satisfies . Without loss of generality, we let T be the maximum number of visits and pad shorter sequences accordingly.
The PHKG is defined as a heterogeneous graph with a node set consisting of union . Edges connect visit nodes to clinical concept nodes according to relation type , corresponding to medication, abnormal laboratory observation, procedure, and heart-failure-specific diagnosis, respectively. Formally, the edge set over the patient visits is given as follows: . Each node is initialized with a learnable embedding vector . For laboratory concepts with numeric measurements, the scalar value is incorporated as a literal attribute of the corresponding node. A categorical node-type indicator distinguishes visit nodes from concept nodes, enabling heterogeneous encoding.
Visit-specific subgraphs are retained only if , , and , ensuring that each admission graph contains sufficient multimodal information. All admission-level subgraphs are subsequently merged into a single global graph PHKG, where identical clinical concepts across visits are represented by shared nodes. This global integration enables parameter sharing and the learning of generalized representations across hospitalizations. By jointly encoding typed predicate relations, numerical laboratory attributes, and semantic embeddings, the PHKG provides a comprehensive and expressive representation for downstream graph neural network tasks.
2.4. Feature Enrichment
To provide rich and semantically meaningful node representations, we enrich both visit nodes and clinical concept nodes with two complementary types of features: high-dimensional semantic embeddings derived from textual descriptions and learned vector representations of numerical measurements.
Textual Attributes—All clinical concepts in medications (), laboratory observations (), and procedures () with labels (concise natural-language descriptions) are further processed to improve feature representations as follows. Medication descriptions combine drug name, dose, route, and unit (e.g., “aspirin 81 mg oral tablet”). Laboratory observations incorporate the measured value, unit, and reference context (e.g., “potassium 3.2 mEq/L low”). Procedure descriptions use the standardized long-title text from the procedure coding system (e.g., “Coronary artery bypass graft”). Each textual description is encoded using a pre-trained sentence transformer, yielding a fixed d-dimensional embedding vector for every concept c. These embeddings are attached directly to the corresponding concept nodes in the graph. For each visit , the semantic information is implicitly propagated from its associated concept nodes during message passing, eliminating the need for explicit visit-level aggregation at construction time.
Numerical Attributes—Numerical laboratory measurements (scalar values associated with concepts in
) are handled in two steps. First, the raw scalar is converted into a textual description (e.g., “potassium 3.2 mEq/L”) and embedded as described above, ensuring the numerical information contributes to the node’s semantic representation. Second, to preserve precise quantitative signal, the raw scalar value is projected into a
d-dimensional vector using a small shared multi-layer perceptron (MLP):
where the MLP consists of two linear layers with Rectified Linear Unit (ReLU) activation. The projected vector
is concatenated with the text-derived embedding
and attached directly to the laboratory concept node
c. This fused representation enables the graph encoder to jointly reason over linguistic clinical context and exact numerical measurements during message passing.
By attaching both text-derived semantic embeddings and MLP-projected numerical vectors directly to the concept nodes, the PHKG nodes become richly annotated with clinically meaningful features. This node-centric enrichment strategy leverages the graph structure to propagate and integrate information across visits and concepts, providing a powerful and homogeneous input to downstream graph neural network tasks, as shown in
Figure 3.
4. Experimentation
The dataset used in this study is derived from the MIMIC-III clinical database. Hospital admissions are linked with encoded visit representations and each admission is treated as a visit node, and patient histories are represented as sequences of visits ordered by admission time. To reconstruct longitudinal care trajectories, admissions for each patient are ordered chronologically based on admission time. Since patients exhibit heterogeneous numbers of admissions, visit sequences are padded to a fixed maximum length
to enable batch processing during model training. Corresponding masking vectors are used to identify valid visits and distinguish them from padded positions. Text attribute embeddings are obtained using the sentence transformer (pretrained) [
29].
In our experiments, three clinical tasks are considered in a supervised learning setting with labels extracted as described in
Section 2.3. For each task, we first perform a grid search of model configurations on a held-out set of 154 patients to evaluate the impact of architectural choice. The grid spans three embedding dimensions (30, 100, 300), four graph encoders (GCN/GAT/RGCN/GIN subset), three sequence decoders (GRU, LSTM, Transformer), and varying network depths (1, 3, 5, 10 layers for both encoder and decoder), resulting in over 570 configurations, as shown in
Figure 6. Each point in the plot corresponds to the maximum mean accuracy (MMA) between AUPRC and AUROC scores per configuration. The best configuration based on the MMA scores is selected for the main results, as shown in
Table 5. Average training time is also reported in seconds per epoch.
For the main results, the remaining data are partitioned in 80/20 train–test splits at the patient level, preventing information leakage across patient trajectories, for a total of 8000 training and 2000 test patients (excluding 154 validation patients). All models are trained for 100 epochs using the Adam optimizer (lr = 0.001) and on an NVIDIA A100 GPU system, repeated over five runs with random initialization. We use a feature dimension size of 32 for text and numerical embeddings, and hidden dimensions of 512 and 128 in all encoders and decoders, respectively, with a dropout value of 0.2. The encoder output dimension is set to 256, and, 4 attention heads are used in case of GAT and transformers. All other encoder and decoder parameters are set as default.
State-of-the-art methods for clinical prediction for comparison in this work are selected, which rely on deep sequential models, attention mechanisms, and graph-based learning to capture the temporal and structural complexity of EHRs. As a sequence-based architecture, Dipole [
10] employs bidirectional recurrent neural networks to model patient visit sequences, and RETAIN [
9] introduces a reverse-time attention mechanism to improve interpretability while predicting clinical outcomes. Among other sequential methods, HiTANet [
11] incorporates hierarchical time-aware attention to capture irregular time intervals between visits, while StageNet [
13] leverages LSTM-based architectures to explicitly model disease progression stages. Other methods focus on adaptive feature extraction and patient similarity learning, such as AdaCare [
12], which dynamically recalibrates clinical features, and GRASP [
14], which learns patient representations by exploiting similarities across patient trajectories. Additionally, ManyDG [
17] uses variational autoencoders to improve generalization across clinical tasks.
More recent approaches increasingly integrate external knowledge and graph structures; CGL [
15] and KGxDP [
16] represent codified data as patient knowledge graphs for reasoning and further incorporate clinical notes to enhance diagnosis prediction; however, these do this without an explicit learnable time component or numerical integration. The approaches in TCEM [
21] and KCIF [
19] adopt temporal heterogeneous graphs to capture interactions among medical entities and numerical values extracted from patient health knowledge graphs; however, these do this without textual side information. Temporal and context-driven predictions using relate-aware transformers and large language models (LLMs) are further explored in HEART [
18] and DemGraph [
20], respectively; however, these do this without an explicit time-dependence component.
Collectively, these methods demonstrate a variety of design options toward hybrid frameworks that combine knowledge-aware graph learning, multi-type integration, and temporal modeling to better represent the complex, multi-relational structure of healthcare data. The details of which specific components are included among these methods in terms of Learnable Temporal Component (LTC), task coverage (Diagnosis, Readmission, and Mortality), multi-modal input integration (Codified, Numerical, and Textual), Knowledge Graph capability for reasoning (KG), and Uncertainty Quantification (UQ) are shown in
Table 6.
The results in
Table 7 compare the proposed SeqGNN with the above state-of-the-art baselines across clinical prediction tasks. For mortality prediction (Mx), SeqGNN achieves the highest AUPRC (20.7), outperforming prior baselines in terms of precision–recall performance. In terms of AUROC, it scores lower than the best-performing baseline, ManyDG (66.3), with StageNet (61.5) as the second best. In readmission prediction (Rx), SeqGNN attains the best AUROC (71.5), improving over the previous best model ManyDG (68.6). It achieves comparable AUPRC (68.5), on par with DemGraph (68.7). For the diagnosis prediction task (Dx), SeqGNN achieves the highest AUROC (93.1) and F1-score (79.1), surpassing the previous best model KCIF (AUROC 87.5, F1 Score 75.7). Overall, these results demonstrate that SeqGNN consistently achieves competitive performance and generalization across multiple clinical tasks, with patient knowledge graph integration and trainable temporal components.
To further evaluate the impact of different text embedding methods, we conducted an experiment using the validation set with a lightweight SeqGNN, configured by a single graph encoder layer and a single sequence decoder layer, using a GIN encoder and a Transformer-based decoder, and a reduced embedding dimension of 30. Multiple embedding methods, including the sentence transformer (SenTrans) [
30], Long-Document Transformer (longformer) [
31], Word2Vec [
32], and One–Hot encoding of data, were evaluated under identical training conditions. Performance was assessed using AUROC and F1 for diagnosis prediction, and AUROC and AUPRC for readmission prediction, with the results reported in
Table 8 as mean and standard deviation across five runs. These results demonstrate the advantage of using sentence transformer, with statistically significant improvements as measured via the Cohen’s d coefficient.
4.1. Uncertainty Quantification and Model Calibration
To evaluate the reliability of the graph neural network predictions for heart-failure diagnosis codes, we implement an ensemble-based uncertainty quantification framework. Ten independent models (), each with identical architecture, were trained from different random initializations for 100 epochs each. Predictive probabilities on the held-out test set were collected across all ensemble members, enabling separate quantification of epistemic uncertainty (model disagreement) and aleatoric uncertainty (inherent data stochasticity). The results are detailed in the following subsections.
4.1.1. Ensemble ROC
For each task, the AUROC curves are shown in
Figure 7 using the 10-SeqGNN ensemble. It can be observed that for the task of HF diagnosis, the highest AUROC is reached at 0.97 with small cross-model variance. This suggests that the ensemble setting improves model confidence while increasing performance. A similar pattern is observed for 30-day readmission prediction where the SeqGNN members consistently perform determining the outcome given patient representations. In the case of mortality, however, high variance and low rates indicate uncertainty in predictions (close to a random classifier) among ensemble members and suggest the need for further tuning for practical usage.
4.1.2. Model Calibration
To evaluate whether the model reproduces the empirical mortality characteristics across diagnosis codes, a subgroup calibration analysis is performed [
33]. First, the observed mortality rate is computed for each diagnosis code using the evaluation dataset. For a given code, the empirical mortality rate is defined as the proportion of admissions associated with that code that resulted in in-hospital death. The trained model is applied to the same evaluation set to obtain predicted mortality probabilities for each admission. For each diagnosis code, all admissions containing that code are grouped together, and the mean predicted probability of mortality across those admissions is calculated. This average predicted probability represents the model’s expected mortality rate for patients associated with that diagnosis code.
The calibration analysis, shown in
Figure 8 (left), indicates that the model’s predictions are highly consistent with the observed mortality rates across HF diagnosis codes. For each ICD-9 code, the predicted rate (derived from model accuracy) closely matches the empirically observed mortality rate, with absolute errors close to zero. This implies that, at the diagnosis-code level, the proportion of predicted positive outcomes aligns almost perfectly with the true outcome frequency in the dataset. Furthermore, this pattern holds across common codes (e.g., 4280 with 2618 admissions) as well less frequent codes, suggesting stable calibration even when admission counts vary. Overall, these results indicate that the model’s probability estimates are well calibrated with respect to HF diagnosis groups; however, the model underpredicts for mortality task.
The calibration analysis for the readmission prediction model in
Figure 8 (right) shows that for common ICD-9 codes with sufficient samples, the predicted accuracies are generally close to the observed readmission rates, indicating reasonable calibration. However, for rare codes with small counts (e.g., 42,821, 42,841, 4281), the model tends to over- or underpredict, leading to larger deviations from perfect calibration. Overall, the model demonstrates partial calibration, with reliable predictions primarily for the more frequent HF codes, while predictions for infrequent codes are less stable and overconfident.
Post hoc calibration was applied to assess the reliability of the model’s probability outputs, as shown in
Table 9. For the diagnosis task, both Temperature Scaling and Platt Scaling yielded modest improvements in calibration, with Platt Scaling achieving the lowest ECE (0.018 versus 0.029 uncalibrated) while maintaining the same high AUPRC of 0.91. For the readmission task, calibration provided marginal benefits, reducing ECE from 0.031 to approximately 0.026–0.027, with no change in AUPRC (0.84). The most substantial improvement was observed for mortality prediction, where both calibration methods dramatically reduced ECE from 0.021 to below 0.001, accompanied by a slight increase in AUPRC from 0.111 to 0.112. Overall, these results demonstrate that post hoc calibration effectively improves probability calibration—particularly for more challenging tasks such as mortality prediction—without compromising discriminative performance learned through the patient knowledge graphs using SeqGNN.
4.1.3. Predictive Variance
Epistemic uncertainty is assessed via predictive variance, defined as the sample variance of output probabilities across the 10 ensemble members for each test instance and diagnosis code. Variance distributions were visualized in
Figure 9a, using kernel density estimate with and stratified by ground-truth label (positive vs. negative). Negative instances consistently exhibited low variance (mean ≈ 0.002–0.005), reflecting high ensemble agreement. Positive instances, which are far rarer in the test set, displayed moderately higher variance (mean ≈ 0.004–0.008), indicating greater model uncertainty when confirming specific heart failure phenotypes. The overall low variance magnitudes suggest reasonable model stability given the small cohort size.
4.1.4. Predictive Probability
The spread of predicted probabilities across ensemble runs provides direct insight into model confidence and output stability, as shown in
Figure 9b. Probability distributions for negative instances were tightly concentrated near zero (mean ≈ 0.05–0.15), whereas positive instances received substantially higher mean probabilities (typically 0.6–0.8 for prevalent codes such as 4280 and 42821) for diagnosis and readmission tasks. Narrow distributions for the dominant code 4280 (present in all test samples), but wider spreads for rare subtypes, consistent with greater uncertainty on infrequent labels are observed. These patterns indicate that the ensemble produces conservative probability assignments for minority classes, which is clinically desirable but highlights the need for confidence-based filtering to improve.
4.1.5. Predictive Entropy
Aleatoric uncertainty as shown in
Figure 9c, is quantified using predictive entropy, computed as the binary cross-entropy of the ensemble mean probability averaged over diagnosis codes for each test sample as follows:
where
is the mean probability across runs. It can be seen that the mean entropy values increases from diagnosis to mortality, consistent with above findings. Entropy thus complements variance by isolating irreducible data-driven uncertainty, offering clinicians a complementary signal for identifying cases that may warrant additional diagnostic review. The overall per-sample entropy values followed a unimodal distribution with mean ≈ 0.35 bits, indicating moderate intrinsic stochasticity in the heart failure cohort.
5. Discussion
In this section, we discuss the key findings of this study and provide answers to the three research questions (RQ) initially posed that examine the role of model design, confidence, and uncertainty in shaping the performance and reliability of SeqGNNs for clinical prediction tasks. Together, these analyses provide insight into not only how these models perform, but also how their behavior can inform model development and deployment in real-world clinical settings.
[RQ1]: Which components of sequential and longitudinal EHR modeling (temporal learning, multimodal fusion, and knowledge graph integration) are most influential for each clinical prediction task, and how effectively does a unified architecture combine these components across diagnosis, readmission, and mortality prediction? By comparing SeqGNN with a broad range of prior models that selectively incorporate temporal dynamics, modality-specific encoders, and knowledge graph structure, we can identify which modeling components are most effective for each clinical task and how well they transfer when unified in a single architecture.
For diagnosis prediction, the results show that strong performance is primarily driven by rich temporal modeling combined with structured knowledge graph integration, as SeqGNN achieves the highest MMA score of 86.1 (with AUROC 93.1 and F1 score 79.1), outperforming prior static, graph-enhanced and transformer-based models, indicating that fine-grained temporal dependency modeling is particularly critical for capturing diagnostic patterns. In this case, the second highest prior is achieved by KCIF, which uses patient graphs with MMA score of 81.6 (see
Table 1), a decrease of 4.5 points in MMA, attributed to the lack of textual integration (see
Table 6). Among prior models that do include an LTC, namely DIPOL, RETRAIN, and CGL, with MMA scores of 76.2, 77.2, and 79.2 respectively, undesirable decreases in performance for onset diagnosis prediction are observed. Among prior models that do not utilize patient knowledge graphs explicitly, HiTANet achieves the highest MMA score of 77.3, a further reduction of 8.75 points. TCEM, as a prior model that utilizes knowledge graphs representations, without textual or numerical integration, achieves an MMA of 79.9, signifying the added value from both knowledge graph and multi-modal integration. These findings highlight the importance of learnable MLP and integrated components combined with patient knowledge graph representations as proposed by SeqGNN.
For readmission prediction, similar improvements are observed associated with the integration of temporal progression modeling and patient-level structural context, where SeqGNN achieves the best AUROC (71.5) and remains competitive in AUPRC, suggesting the value in capturing longitudinal disease evolution and inter-event relationships. In particular, DemGraph, with a score of 71.3, exhibits a decrease of 2.35 in MMA due to the lack of an LTC. For mortality prediction, on the other hand, the most influential component appears to be multimodal signal integration, indicating that while structured and temporal components improve sensitivity to rare outcomes, mortality prediction remains highly sensitive to class imbalance and may require more specialized discriminative modeling. Overall, these findings show that temporal learning is beneficial, knowledge graphs enhance structured reasoning, and multimodal integration improves sensitivity in rarer outcomes. The proposed SeqGNN demonstrates that combining all components as such yields stronger generalization.
[
RQ2]: What further insights do uncertainty and calibration analyses reveal about the reliability, limitations, and predictive behavior of the proposed SeqGNN architecture across clinical tasks? Uncertainty and calibration analyses provide a deeper understanding of model behavior beyond aggregate metrics, revealing where predictions are reliable and where limitations arise. Epistemic uncertainty, measured through ensemble variance, shows that the model is highly stable for negative cases and common diagnostic patterns, but exhibits increased uncertainty for positive and rare phenotypes, indicating that prediction difficulty is concentrated in clinically complex or underrepresented regions. Aleatoric uncertainty, captured via predictive entropy, further highlights that mortality prediction, with an entropic value around 0.5, is inherently more uncertain than diagnosis and readmission (see
Figure 9), suggesting fundamental limits in predictability given the available data. Calibration analysis reinforces these findings: while diagnosis and readmission tasks are reasonably well calibrated—especially for frequent ICD-9 codes—mortality predictions show greater miscalibration and benefit significantly from post hoc correction (see
Table 9). Overall, these analyses show that SeqGNN models are reliable in routine settings but less so in rare, high-risk scenarios, making uncertainty quantification an essential diagnostic tool for identifying model blind spots and guiding targeted improvements.
[
RQ3]: To what extent can the relationship between encoder–decoder configurations, uncertainty, and performance inform future model deployment in decision support systems that rely on patient knowledge graphs and sequential modeling? The above findings highlight promising directions for leveraging confidence-aware modeling towards clinical deployment. Given that low correlations are present between patient records and outcomes based on the tasks studied in this work (see
Figure 2), the addition of knowledge graph representation for patient visit trajectories is a recommended choice, as evident in the above analysis (see
Table 1). Furthermore, various parameter settings and configurations are evaluated and found to be important in selecting final models (see
Figure 6) as measured by the MMA scores on validation data. Such model variations combined with ensemble SeqGNNs strategies can be systematically incorporated into decision-making frameworks, such as deferring low-confidence predictions, prioritizing high-confidence cases, or integrating human-in-the-loop validation for uncertain outcomes. Further research is needed to investigate how confidence–performance relationships behave utilizing these methods in practice as well as under distribution shifts, class imbalance, and external validation cohorts, ensuring robustness in diverse clinical environments. Ultimately, these directions point toward the development of confidence-aware deployment strategies that enhance the safety, interpretability, and trustworthiness of clinical prediction systems.