TLDR: CoFE is a novel framework that enhances the interpretability of AI-based ECG models by generating “CounterFactual ECGs.” Unlike traditional methods that only show where an AI focuses, CoFE illustrates how specific ECG features (e.g., P-wave amplitude, T-wave duration) influence a model’s predictions by creating “what-if” scenarios. This allows clinicians to visualize the minimal changes in an ECG that would alter an AI’s diagnosis, making the AI’s reasoning more transparent and clinically meaningful for tasks like atrial fibrillation classification and potassium level regression.
Artificial intelligence (AI) is rapidly transforming medical diagnostics, particularly in analyzing electrocardiograms (ECGs) to predict cardiac conditions. However, for AI models to be truly integrated into clinical practice, clinicians need to understand not just what the AI predicts, but also *how* and *why* it arrives at those conclusions. This is where Explainable AI (XAI) becomes crucial.
Traditional XAI methods, such as Saliency Maps, can show *where* an AI-ECG model focuses its attention on an ECG signal. While helpful, these methods often fall short in explaining *how* changes in specific ECG features influence the model’s predictions. To address this limitation, researchers Jong-Hwan Jang, Junho Song, and Yong-Yeon Jo from MedicalAI Co., Ltd. have introduced a novel framework called CoFE: CounterFactual ECG for Explainable Cardiac AI-Diagnostics.
What is CoFE?
CoFE is designed to generate ‘CounterFactual ECGs’ – hypothetical ECG signals that illustrate how specific features, like the amplitude of waves or the duration of intervals, affect an AI model’s diagnostic decisions. Essentially, CoFE explores ‘what-if’ scenarios, allowing clinicians to visualize how subtle alterations in an ECG could shift an AI’s prediction. This provides a deeper understanding beyond just identifying regions of interest, revealing the causal relationship between ECG features and AI outcomes.
How CoFE Works
The CoFE framework integrates three core components: a generator, an encoder, and a predictive model. The generator is trained on a vast dataset of real ECGs to synthesize clinically plausible signals. The encoder then translates a real ECG into a format the generator understands. Finally, the predictive model is the AI-ECG diagnostic tool whose decisions CoFE aims to explain.
When a clinician provides an ECG, CoFE takes its latent representation and iteratively modifies it in a way that encourages the predictive model to shift its diagnosis towards a user-defined target. For instance, if an ECG is initially classified as normal, CoFE can generate a counterfactual ECG that the AI would classify as abnormal, highlighting the minimal changes required to cause that shift. Because these modifications happen within the learned space of clinically realistic ECGs, the resulting counterfactuals remain physiologically believable.
A User-Friendly Workflow
CoFE follows a straightforward four-stage workflow:
- Upload ECG File: Clinicians upload a standard ECG file.
- AI Diagnosis: The pretrained AI model analyzes the ECG and provides its initial diagnosis.
- Generate Explanations: CoFE synthesizes counterfactual ECGs that alter the model’s output and also visualizes saliency maps for the original signal.
- Compare and Interpret: The clinician can then compare the original and counterfactual ECGs side-by-side. Key feature changes and prediction differences are highlighted, making the AI’s reasoning transparent and clinically meaningful.
This interactive approach allows clinicians to explore how changes in specific intervals (like RR variability) or amplitudes (like P- or T-wave amplitude) influence predictions, fostering a more intuitive understanding of the AI’s decision-making process.
Real-World Applications
The researchers demonstrated CoFE’s utility through two critical case studies:
- Atrial Fibrillation (AF) Classification: AF is characterized by irregular RR intervals and diminished P-waves. CoFE successfully generated counterfactual ECGs that, when compared to original ECGs, showed a significant reduction in P-wave amplitude and an increase in RR interval variability, pushing the AI’s prediction towards AF. This aligns perfectly with established clinical knowledge.
- Potassium Level Regression: Elevated potassium levels often manifest as increased T-wave amplitude and prolonged QRS duration on an ECG. CoFE-generated counterfactuals for this task exhibited these precise changes, leading to higher predicted potassium levels by the AI model.
In both scenarios, CoFE’s explanations were not only consistent with clinical understanding but also provided a visual representation of *how* the AI linked these specific ECG features to its diagnostic outcomes. The framework combines the ‘where’ (saliency maps) with the ‘how’ (counterfactuals), offering a comprehensive explanation.
Also Read:
- A Unified AI Model for Healthcare Data: Predicting Outcomes and Generating Clinical Narratives
- Advancing Ophthalmic AI: A New Dataset and Dynamic Reasoning Model for Eye Care
Conclusion
The CoFE framework represents a significant step forward in making AI-based ECG models more interpretable and trustworthy for clinicians. By generating counterfactual ECGs, it bridges the gap between complex AI predictions and actionable clinical insights, ultimately supporting more informed decision-making in cardiac care. The full research paper can be found here: CoFE: A Framework Generating Counterfactual ECG for Explainable Cardiac AI-Diagnostics.


