Abstract
We have recently seen many successful applications of recurrent neural networks (RNNs) on electronic medical records (EMRs), which contain histories of patients' diagnoses, medications, and other various events, in order to predict the current and future states of patients. Despite the strong performance of RNNs, it is often challenging for users to understand why the model makes a particular prediction. Such black-box nature of RNNs can impede its wide adoption in clinical practice. Furthermore, we have no established methods to interactively leverage users' domain expertise and prior knowledge as inputs for steering the model. Therefore, our design study aims to provide a visual analytics solution to increase interpretability and interactivity of RNNs via a joint effort of medical experts, artificial intelligence scientists, and visual analytics researchers. Following the iterative design process between the experts, we design, implement, and evaluate a visual analytics tool called RetainVis, which couples a newly improved, interpretable and interactive RNN-based model called RetainEX and visualizations for users' exploration of EMR data in the context of prediction tasks. Our study shows the effective use of RetainVis for gaining insights into how individual medical codes contribute to making risk predictions, using EMRs of patients with heart failure and cataract symptoms. Our study also demonstrates how we made substantial changes to the state-of-the-art RNN model called RETAIN in order to make use of temporal information and increase interactivity. This study will provide a useful guideline for researchers that aim to design an interpretable and interactive visual analytics tool for RNNs.
Introduction
Deep learning, particularly Recurrent Neural Networks (RNNs), has shown immense promise in predicting patient outcomes from Electronic Medical Records (EMRs). However, two major hurdles prevent their widespread adoption in clinical practice: the "Black Box" problem, where clinicians cannot easily interpret the specific triggers for a high-risk prediction, and a lack of interactivity, which prevents doctors from adjusting model logic based on domain expertise. RetainVis addresses these challenges by coupling a novel model architecture, RetainEX, with an interactive visual interface designed for clinical exploration.
Methods: The RetainEX Model
RetainEX improves upon the state-of-the-art RETAIN (REverse Time AttentioN) model through three key innovations:
- Bidirectionality: It utilizes bidirectional RNNs to capture both the chronological progression of diseases and retrospective cues.
- Temporal Awareness: Unlike standard sequence models, RetainEX explicitly incorporates time intervals ($\Delta t$) between visits, recognizing that the density of medical events is a critical predictive feature.
- Interactive Retraining: A specialized loss function allows the model to be retrained in milliseconds based on user feedback, enabling real-time "what-if" analysis.
The RetainVis Interface
The visual system consists of five coordinated views designed to facilitate cohort and individual patient analysis. This includes a t-SNE-based overview for cohort exploration, contribution heatmaps for temporal analysis, and a patient editor for simulating clinical scenarios.
Evaluation and Results
The system was evaluated using the HIRA-NPS dataset, containing records for approximately 1.4 million patients in South Korea. The researchers focused on two binary classification tasks: predicting the future risk of Heart Failure and Cataracts.
RetainEX consistently outperformed baseline models, including standard GRUs and the original RETAIN model. Notably, the inclusion of temporal information significantly boosted accuracy. Furthermore, the interactive retraining capability proved highly efficient, taking an average of just 0.015 seconds to update the model after user modifications.
Discussion and Conclusion
RetainVis demonstrates that human-in-the-loop steering can improve model performance and trust. By visualizing "attention"—highlighting specific visits and medical codes driving risk scores—the system turns complex tensor calculations into actionable clinical insights. While future work is needed to address scalability for larger cohorts and to integrate the tool into high-pressure clinical workflows, RetainVis provides a robust framework for building interpretable and interactive AI for healthcare.
Summary updated