YASSIR/ yassir.dev
03Machine Learning / Clinical Research

Heart Failure Mortality Prediction

Mortality Risk Prediction in Heart Failure Patients Using Transfer Learning-Based TabNet and Explainable AI with SHAP

An empirical machine learning investigation on the UCI Heart Failure Clinical Records cohort using transfer learning strategies and SHAP explainability to evaluate mortality risk discrimination. Published and presented in IEEE ICIMCIS 2025.

Role
Machine Learning Research
Timeline
2025
Context
Clinical Prediction & Explainable AI
PythonPyTorchTabNetTransfer LearningSHAPSMOTEScikit-learnPandasNumPy
01 // CLINICAL CONTEXT

Problem Statement & Clinical Motivation

Cardiovascular diseases, particularly heart failure, remain a leading cause of mortality globally. Early and accurate mortality risk prediction can help clinicians allocate intensive monitoring and interventions.

Clinical tabular datasets frequently suffer from small sample sizes, severe class imbalance (substantially fewer mortality events compared to survivors), and non-linear physiological interactions.

Standard deep neural networks often underperform gradient-boosted decision trees on tabular domains, and black-box models lack the transparency demanded by medical professionals.

RESEARCH OBJECTIVES

Investigation Goals

  • 01Investigate whether TabNet, an attention-based neural architecture designed specifically for tabular data, can achieve competitive discrimination when combined with transfer learning.
  • 02Evaluate four distinct experimental transfer learning scenarios to determine the most effective knowledge transfer mechanism for clinical mortality prediction.
  • 03Apply SHAP (SHapley Additive exPlanations) to interpret model predictions and validate learned risk factors against recognized cardiology evidence.
02 // METHODOLOGY

Research Approach & Core Decisions

Employed TabNet with sequential attention mechanisms and sparse feature selection masks. Preprocessed clinical data with standardized scaling and addressed severe class imbalance using SMOTE strictly inside training folds. Formulated four progressive experimental scenarios to evaluate transfer learning effects.

DECISION // 01

TabNet as Core Architecture

TabNet uses sequential attention steps to select sparse subsets of features at each decision step, combining neural representation learning with tree-like decision paths.

DECISION // 02

Fold-Isolated SMOTE Resampling

Applied Synthetic Minority Over-sampling Technique (SMOTE) strictly within training folds to avoid data leakage into validation and testing partitions.

DECISION // 03

Clinical Metric Priority (Recall & PR-AUC)

Prioritized Recall and Precision-Recall AUC over standard Accuracy, because missing a high-risk mortality patient (false negative) carries critical clinical consequences.

DECISION // 04

Global and Local SHAP Attribution

Used SHAP values to explain both overall biomarker importance rankings and patient-level risk trajectories for clinical transparency.

03 // EXPERIMENTAL RESULTS

Multi-Scenario Empirical Evaluation

Four TabNet-based experimental scenarios were evaluated across accuracy, precision, recall, F1 score, ROC AUC, and PR AUC. Each scenario was independently executed 20 times using identical data splits and hyperparameters, with 95% confidence intervals estimated on an 80/20 train-test partition.

S4 Recall (Sensitivity)
0.937
+42.4% vs S1 Baseline
S4 ROC AUC
0.869
+13.9% vs S1 Baseline
S4 PR AUC
0.745
+18.4% vs S1 Baseline
S4 F1 Score
0.639
+9.2% vs S1 Baseline
Comparative Analysis

Metric Comparison Across Scenarios (S1 – S4)

Recall (Sensitivity): Proportion of actual mortality events correctly identified by the model.Critical in clinical screening to minimize false negatives (missed high-risk patients).
S1Baseline TabNet
0.658
S2In-Domain Pretraining
0.813
S3Cross-Domain Transfer
0.761
S4Feature-Based Transfer
Highest0.937

Mean Performance Matrix (20 Independent Runs)

Source: Table III (ICIMCIS 2025)
ScenarioArchitecture PipelineAccuracyPrecisionRecallF1 ScoreROC AUCPR AUC
S1 β€” Baseline TabNetUCI β†’ TabNet0.7040.538 *0.6580.5850.7630.629
S2 β€” In-Domain PretrainingUCI β†’ Reconstruction Pretraining β†’ TabNet0.5960.4430.8130.5630.7370.604
S3 β€” Cross-Domain TransferCVD Dataset β†’ Feature Alignment β†’ Pretraining β†’ UCI Fine-tuning β†’ TabNet0.6830.5000.7610.5970.7570.628
S4 β€” Feature-Based TransferUCI β†’ LR / RF / XGB Models β†’ Probabilistic Meta-Features β†’ TabNet0.6620.4870.937 *0.639 *0.869 *0.745 *
* Indicates highest mean metric across 20 runs.Train/Test: 80% / 20% stratified
Clinical Trade-Off Analysis: Sensitivity vs. Precision

In mortality risk screening, Recall (Sensitivity) is prioritized over raw precision because missing an at-risk mortality event carries severe clinical consequences. Scenario 4 (Feature-Based Transfer) achieves the highest Recall (0.937), ROC AUC (0.869), PR AUC (0.745), and F1 (0.639), successfully identifying the vast majority of positive mortality cases.

Conversely, Scenario 1 (Baseline TabNet) maintains the highest Precision (0.538) with a more conservative decision threshold, resulting in fewer false alarms at the expense of lower sensitivity (Recall 0.658).

04 // EXPERIMENTAL DESIGN

Transfer Learning Pipeline & Scenarios

Four distinct transfer learning configurations were designed and benchmarked to determine the optimal mechanism for transferring tabular representation knowledge to a small-sample clinical mortality dataset.

SCENARIO 01Baseline

Baseline TabNet

Standard TabNet architecture trained from scratch directly on the target clinical cohort with fold-isolated SMOTE resampling.

UCI Data→SMOTE→TabNet Core
SCENARIO 02Self-Supervised

In-Domain Pretraining

Self-supervised masked tabular reconstruction on the same clinical cohort to pretrain encoder representations before supervised fine-tuning.

UCI Data→Reconstruction→Fine-Tuning
SCENARIO 03Cross-Domain

Cross-Domain Pretraining

Pretraining on the external 70,000-record Cardiovascular Disease dataset across aligned common attributes, then transferring encoder weights to UCI fine-tuning.

CVD (70k)→Pretrain→UCI Fine-tune
Optimal Sensitivity Configuration
SCENARIO 04Feature-Based Transfer

Auxiliary Teacher Meta-Features + TabNet

Out-of-fold probabilistic predictions from Logistic Regression, Random Forest, and XGBoost models are concatenated with raw clinical features as inputs into TabNet.

Added Probabilistic Meta-Features:
p_lrp_rfp_xgb
UCI Data→Teacher Models→Meta + TabNet
Architectural Note: The features p_lr, p_rf, and p_xgb are model-derived probabilistic meta-features generated via out-of-fold estimation, not primary clinical measurements.
05 // DATA

Dual-Domain Datasets & Feature Alignment

To evaluate cross-domain pretraining, the research combined a target clinical heart failure cohort with a large-scale cardiovascular disease source dataset across strictly aligned common attributes.

TARGET DOMAIN299 patients

UCI Heart Failure Clinical Records

12 clinical attributes + binary label

Cohort of heart failure patients monitored during follow-up period, recording key biomarkers, physiological indicators, and mortality event outcomes.

Role: Primary evaluation dataset for all four experimental scenarios.
SOURCE DOMAIN70,000+ patient records

Cardiovascular Disease (CVD) Dataset

Overlapping cardiovascular attributes

Large-scale cardiovascular cohort from Kaggle used for self-supervised cross-domain pretraining to learn generalized tabular representations.

Role: Pretraining source for Scenario 3 prior to target domain fine-tuning.

Cardiovascular Cross-Domain Feature Alignment Schema

Only overlapping features were mapped into the pretraining schema. Non-shared CVD variables were excluded.

Aligned (8)Excluded (2)
age
Patient age in years
aligned
sex
Biological sex indicator
aligned
smoking
Tobacco smoking habit
aligned
diabetes
Presence of diabetes diagnosis
aligned
anaemia
Reduction of red blood cells/haemoglobin
aligned
high blood pressure
Hypertension diagnosis history
aligned
serum creatinine
Kidney biomarker (mg/dL)
aligned
serum sodium
Blood electrolyte level (mEq/L)
aligned
cholesterol (CVD)
Categorical scale without direct UCI match
excluded
resting BP (CVD)
Systolic/diastolic values not mapped to binary
excluded
06 // PREPROCESSING

Data Preprocessing & Fold-Isolated SMOTE

A three-stage preprocessing pipeline ensured numerical stability, outlier resistance, and balanced class distributions without introducing data leakage into evaluation folds.

1Missing Value Handling

Median Imputation

  • β€’Missing numerical observations imputed using training fold medians
  • β€’Robust to outliers in clinical biomarker distributions
2Numerical Scaling

StandardScaler

  • β€’Zero-mean and unit-variance normalization: z = (x - u) / s
  • β€’Prevents large-scale attributes from dominating gradient updates
3Class Imbalance Rebalancing

Fold-Isolated SMOTE

  • β€’Sampling strategy: 1.0 (balanced 1:1 training ratio)
  • β€’k-Neighbours: 5, Random state: 42
  • β€’Executed strictly within training folds to prevent validation leakage
SMOTE Resampling Configuration (Fold-Safe Execution)
Sampling Strategy
1.0 (1:1 Ratio)
Full minority oversampling
k-Neighbours Parameter
k = 5
Euclidean synthetic interpolation
Reproducibility Seed
random_state = 42
Deterministic sampling across folds
07 // MODEL

TabNet Architecture & Hyperparameters

TabNet uses sequential attention to select sparse feature subsets at each decision step, enabling neural networks to mimic decision trees while preserving gradient descent optimization.

TabNet Sequential Decision Flow (5 Steps)
Input Layer
Clinical Attributes
β†’
Sparse Mask M[i]
Sequential Attention
β†’
Feature Processing
5 Decision Steps
β†’
Aggregation
Sparse Feature Masks
β†’
Output
Mortality Prediction
Experimental Training Hyperparameters
Decision Steps (N_steps)
5
Sequential attention decision stages
Attention Dimension (N_a)
16
Width of attentive transformer layers
Sparsity Coefficient (Ξ³)
1.5
Controls feature reuse penalty across steps
Learning Rate
0.02
Initial rate with Adam optimizer
Optimizer
Adam
Adaptive moment estimation gradient descent
Batch Size
32
Mini-batch size for training steps
Maximum Epochs
200
Training budget with early stopping
Early Stopping
Validation Loss
Halt training on validation plateau
08 // EXPLAINABILITY

SHAP Attribution & Feature Importance Rankings

SHAP (SHapley Additive exPlanations) was applied to compute feature attribution across experimental configurations, verifying that model decision pathways aligned with established clinical biomarkers while revealing how meta-features dominate Scenario 4.

SCENARIO 1 & 3

Primary Clinical Predictors

Relative Importance

In baseline and cross-domain models, clinical variables directly drive predictions. Follow-up duration (time), ejection_fraction, and serum_creatinine emerge as top mortality predictors.

#1timeFollow-up monitoring duration (days)
#2ejection_fractionPercentage of blood leaving heart at each contraction (%)
#3serum_creatinineBiomarker for renal function and blood filtration (mg/dL)
#4agePatient chronological age (years)
#5serum_sodiumElectrolyte concentration in blood (mEq/L)
Cardiology Concordance: Lower ejection fraction & elevated creatinine correlate with higher risk.
SCENARIO 4

Meta-Features + Clinical Biomarkers

Composite Attribution

In Scenario 4, the model-derived probabilistic meta-features (p_rf, p_xgb, p_lr) become top-ranked dominant predictors, while primary clinical variables serve as secondary guidance.

#1p_rfmetaRandom Forest probabilistic meta-feature
#2p_xgbmetaXGBoost probabilistic meta-feature
#3p_lrmetaLogistic Regression probabilistic meta-feature
#4timeFollow-up monitoring duration (days)
#5ejection_fractionPercentage of blood leaving heart at each contraction (%)
#6serum_creatinineBiomarker for renal function and blood filtration (mg/dL)
#7agePatient chronological age (years)
#8serum_sodiumElectrolyte concentration in blood (mEq/L)
Shift in Attribution: Auxiliary teacher models concentrate discriminative signal before TabNet attention.
Ranking Integrity: The visualization above communicates relative feature importance hierarchy derived from empirical SHAP attribution analysis without fabricating numerical magnitude values.
09 // KEY FINDINGS

Research Insights & Scientific Conclusions

Key conclusions drawn from the empirical comparison of TabNet architectures and transfer learning strategies for clinical mortality risk prediction.

FINDING 01

Feature-based transfer produced the highest recall, ROC AUC, PR AUC, and F1 among the four scenarios.

By augmenting TabNet input with out-of-fold probabilistic predictions from diverse teacher models (Logistic Regression, Random Forest, XGBoost), Scenario 4 achieved a recall of 0.937 and ROC AUC of 0.869.

FINDING 02

Baseline TabNet achieved the highest precision, reflecting a more conservative decision boundary.

Scenario 1 yielded a precision of 0.538. While it generated fewer false alarms, its lower recall (0.658) means a larger fraction of high-risk patients would be missed compared to the transfer configurations.

FINDING 03

Cross-domain transfer increased recall but was affected by distribution differences between the CVD and UCI populations.

Pretraining on 70,000+ general cardiovascular records (Scenario 3) improved sensitivity (recall 0.761 vs 0.658 in baseline), though differing feature distributions between broad CVD and specific heart failure cohorts limited global precision.

FINDING 04

SHAP analysis consistently identified time, ejection fraction, and serum creatinine as important clinical predictors, while Scenario 4 introduced task-aligned probabilistic meta-features.

Attribution patterns confirmed established cardiology literature: lower ejection fraction and elevated serum creatinine correlate with higher mortality risk, while Scenario 4 prioritized probabilistic meta-features as dominant composite predictors.

Research Context & Limitations

Experimental research using public clinical datasets. Results should not be interpreted as a clinically validated diagnostic or decision-support system.

Peer-Reviewed Conference Publication

Mortality Risk Prediction in Heart Failure Patients Using Transfer Learning-Based TabNet and Explainable AI with SHAP

Conference
2025 International Conference on Informatics, Multimedia, Cyber and Information System (ICIMCIS)
Publisher
IEEE