Skip to main content
Dryad

Predicting arrhythmia recurrence post-ablation in atrial fibrillation using explainable machine learning: Code repository

Data files

Jul 15, 2025 version files 47.50 KB

Abstract

Background: Following atrial fibrillation ablation, it is challenging to distinguish patients who will remain arrhythmia-free from those at risk for recurrence. New explainable machine learning (xML) techniques allow for systematic assessment of arrhythmia recurrence risk following catheter ablation. We aim to develop an xML algorithm that predicts recurrence and reveals key risk factors to facilitate better follow-up strategy after an ablation procedure.

Methods: We reconstructed pre-and post-ablation models of the left atrium (LA) from late gadolinium enhanced magnetic resonance (LGE-MRI) for 67 patients. Patient-specific features (LGE-based measurements of pre/post-ablation arrhythmogenic substrate, LA geometry metrics, computational simulation results, and clinical risk factors) trained a random forest classifier to predict recurrent arrhythmia. We calculated each risk factor’s marginal contribution to model decision making via SHapley Additive exPlanations (SHAP). Here we provide code for xML model training, validation, and explanation in our associated publication "Predicting arrhythmia recurrence post-ablation in atrial fibrillation using explainable machine learning" in Communications Medicine. This code serves to train and test a random forest classifier and then applies SHAP analysis offers explanations of model classifications.

Results: The classifier accurately predicts post-ablation arrhythmia recurrence (mean receiver operating characteristic [ROC] area under the curve [AUC]: 0.80±0.04; mean precision-recall [PR] AUC: 0.82±0.08). SHAP analysis reveals that of 89 features tested, the key population risk factors for recurrence are: large left atrium, low LGE-quantified post-ablation scar in the atrial floor region, and previous attempts at direct current cardioversion. We also examine patient-specific recurrence predictions, since xML allows us to understand why a particular individual can have large prediction weights for some categories without tipping the balance towards an incorrect prediction. Finally, we validate our model in a completely new, 15-patient retrospective holdout cohort (80% correct).

Conclusion: Our SHAP-based explainable machine learning approach is a proof-of-concept clinical tool to explain arrhythmia recurrence risk in patients who underwent ablation by combining patient-specific clinical profiles and LGE-derived data.