Explainable artificial intelligence for pharmacovigilance: What features are important when predicting adverse outcomes?

Isaac Ronald Ward, Ling Wang, Juan Lu, Mohammed Bennamoun, Girish Dwivedi, Frank M. Sanfilippo · DOI

Introduction

Pharmacovigilance is the critical science of monitoring drug safety after a product has entered the market. Traditional methods, such as spontaneous reporting or retrospective observational studies, often suffer from significant delays, sometimes taking years to identify dangerous side effects. A prominent historical example is the non-steroidal anti-inflammatory drug (NSAID) rofecoxib (Vioxx), which remained on the market for years before being withdrawn in 2004 due to its association with increased risks of myocardial infarction and stroke.

While Machine Learning (ML) offers the potential to scan massive datasets for such patterns, high-performing models are frequently criticized as "black boxes." In a clinical or regulatory context, simply identifying a patient at risk is insufficient; stakeholders must understand the underlying reasons for a prediction. This study addresses this challenge by integrating Explainable AI (XAI) into the drug-monitoring pipeline to make predictive models transparent and actionable.

Methodology

Study Design and Timeline

The researchers established a specific temporal framework for data analysis. As shown in Figure 1, the study utilized a 10-year "lookback" period to establish patient comorbidities and a 6-month window prior to the index date ($t_0$) to capture drug history. The objective was to predict the likelihood of an Acute Coronary Syndrome (ACS) event within a one-year follow-up period following the first dispensing event of specific drug classes.

Figure 1: Study timeline showing the lookback periods for comorbidity and drug history relative to the index event and the subsequent follow-up period.

Data Sources and Modeling

The study utilized a massive, de-identified dataset from Western Australia (1993–2009), linking the Pharmaceutical Benefits Scheme (PBS) dispensing records, hospital morbidity and emergency department data, and the Deaths Register. The final cohort focused on individuals over 65 prescribed musculoskeletal or cardiovascular drugs. Feature vectors included 158 dimensions encompassing age, sex, drug history, and 76 comorbidity conditions.

Three tree-based ensemble models were employed: Random Forests (RF), Extra Trees (ET), and eXtreme Gradient Boosting (XGB). To interpret these models, the researchers compared four XAI techniques:

  1. Traditional Metrics: Mean Decrease of Impurity (MDI) and Mean Decrease in Accuracy (MDA).
  2. Modern XAI: Local Interpretable Model-agnostic Explanations (LIME) and SHapley Additive exPlanations (SHAP).

Results and Discussion

Predictive Performance and Feature Importance

The XGB model achieved the highest predictive performance with an Area Under the Curve (AUC) of 0.72 and an overall accuracy of 72%. While age and sex were consistently the strongest predictors across all models, the XAI methods successfully identified specific clinical features contributing to ACS risk.

Figure 4: Comparison of feature importance across four XAI methods (MDI, MDA, LIME, and SHAP). The plots highlight key predictors such as age, sex, specific drugs (rofecoxib, celecoxib, nitrates), and comorbidities like heart failure.

As illustrated in Figure 4, the models successfully flagged rofecoxib and celecoxib as top predictors for ACS. This serves as a vital validation of the framework, as the AI independently identified the same risks that led to real-world drug withdrawals.

Comparison of XAI Techniques

The study provided critical insights into the reliability of different explanation methods:

  • SHAP vs. LIME: SHAP proved more consistent and slightly outperformed LIME. LIME exhibited higher variance between runs, which is a significant drawback for clinical applications where stability is paramount.
  • Handling Noise: By intentionally adding random "noise" features to the data, the researchers found that MDA and SHAP correctly ignored these irrelevant inputs. In contrast, the traditional MDI metric showed a bias toward noise, highlighting the superiority of modern XAI for high-stakes medical data.

Conclusion

This research demonstrates that XAI can transform "black box" models into transparent early-warning systems for pharmaceutical safety. By quantifying the contributions of specific drugs and comorbidities, these systems could potentially flag risks like those of rofecoxib much earlier than traditional methods.

Future work should focus on benchmarking these methods against more granular clinical datasets, such as Electronic Health Records (EHR), which capture lifestyle factors and laboratory results not present in administrative data. Additionally, exploring counterfactual explanations could provide deeper, patient-specific insights for clinical decision support.

Summary updated

BibTeX
@inproceedings{ward2021explainable,
  author = {Isaac Ronald Ward and Ling Wang and Juan Lu and Mohammed Bennamoun and Girish Dwivedi and Frank M. Sanfilippo},
  title = {{Explainable artificial intelligence for pharmacovigilance: What features are important when predicting adverse outcomes?}},
  booktitle = {Comput. Methods Programs Biomed},
  year = {2021},
  doi = {10.1016/j.cmpb.2021.106415},
}
Figure