Doctor XAI: Decoding Sequential Medical Predictions through Ontological Intelligence
An ontology-based approach to black-box sequential data classification explanations
This paper introduces Doctor XAI, a model-agnostic explainability framework specifically designed for sequential, multi-label black-box classifiers in healthcare. Applied to the Doctor AI recurrent neural network, it achieves high local fidelity by generating ontology-aware synthetic neighborhoods and extracting human-understandable decision rules.
TL;DR
The paper introduces Doctor XAI, a framework designed to open the "black box" of sequential clinical models like RNNs. By utilizing medical ontologies (ICD-9), it generates smart perturbations that reflect clinical reality, flattening temporal data into interpretable decision rules with high fidelity (~0.89 F1) and human-readable logic.
Background & Motivation: The Opaque Reality of AI in Medicine
Deep Learning models, particularly Recurrent Neural Networks (RNNs) like Doctor AI, have shown remarkable accuracy in predicting future diagnoses from Electronic Health Records (EHR). However, their "black-box" nature is a deal-breaker in healthcare due to:
- Trust & Safety: Doctors cannot verify the "why" behind a high-risk prediction.
- Regulatory Compliance: GDPR Article 22 requires "meaningful information about the logic involved" in automated decisions.
Existing XAI tools like LIME were built for tabular or image data. They fail in medicine because they treat medical codes as independent features, ignoring that "Food Poisoning" and a "Broken Wrist" are semantically distinct, whereas two types of "Carotid Artery Stenosis" are siblings in a hierarchy.
Methodology: The Doctor XAI Pipeline
The authors propose a multi-stage pipeline that bridges the gap between complex sequences and simple rules.
1. Ontological Distances & Selection
Instead of simple Jaccard similarity, Doctor XAI uses Wu-Palmer Similarity and Dynamic Time Warping (DTW). This identifies "neighbors" in the dataset who have clinically similar histories, not just overlapping codes.
2. Smart Perturbation (The Blue Path)
Standard XAI uses random noise. Doctor XAI uses the ICD-9 Ontology. It selectively masks concepts at various levels of the hierarchy (e.g., masking all "Acid-base balance disorders" rather than a single specific code). This explores the black-box's sensitivity to broad clinical conditions.

3. Temporal Encoding
To feed a sequence into a Decision Tree (the surrogate model), the authors use a Binary Exponential Decay Encoder. Recent visits are weighted higher () than older ones (, etc.), preserving the "recency effect" of clinical events in a flat vector.
Experimental Validation
Using the MIMIC-III dataset, the authors compared three pipelines:
- Doctor XAI (Ontology + Ontological Perturbation)
- Ontological + Normal Perturbation
- Non-ontological Baseline
Key Findings:
- Fidelity Advantage: The ontological pipeline consistently achieved higher fidelity (the degree to which the explanation matches the black box) compared to non-semantic methods.
- Neighborhood Density: Training the surrogate model on a dense synthetic neighborhood yielded better results than using limited real historical data.

Case Study: From Math to Medicine
The true power of Doctor XAI is seen in its output (Figure 9). Instead of a list of feature weights (as in SHAP), it provides a Decision Rule.
- Example Rule: "If ICD-9 584.5 (Acute Kidney Failure) was observed in the last three visits AND code 518.81 (Acute Respiratory Failure) was present, then predict X."

Critical Insight & Conclusion
Doctor XAI proves that context matters. In specialized domains like medicine, purely statistical explainability is insufficient. By "teaching" the XAI the hierarchical structure of medicine, the researchers created a tool that speaks the doctor's language.
Limitations: The method currently focuses on classification (predicting the next diagnosis code). Future work is needed to adapt this to regression tasks (e.g., predicting length of stay or mortality risk) and to further reduce the complexity of the generated rules as the "neighborhood" grows.
Summary (Takeaway): For AI to be deployed in high-stakes environments, our interpretability tools must be as sophisticated as the domain's own structured knowledge.
