survxai: an R package for structure-agnostic explanations of survival models

Aleksandra Grudziaz, Alicja Gosiewska, Przemyslaw BiecekJ. Open Source Softw 2018 · DOI · DBLP

Introduction

Survival analysis, or time-to-event modeling, is a cornerstone of predictive analytics in high-stakes domains such as medicine, insurance, and engineering. While traditional statistical methods like the Cox Proportional Hazards model are highly interpretable, modern machine learning techniques—such as survival random forests and deep neural networks—often provide superior predictive accuracy. However, these "black-box" models lack transparency, making it difficult for practitioners to understand the underlying logic of a prediction.

The survxai R package addresses this gap by providing a suite of model-agnostic tools specifically designed for survival models. Unlike standard Explainable AI (XAI) frameworks that handle scalar outputs (regression or classification), survxai is built to interpret functional outputs: the survival curves themselves.

Methodology and Explainer Classes

The package implements four primary explainer classes, categorized into local (individual-level) and global (population-level) perspectives.

Local Explanations

Local explainers focus on understanding the prediction for a single observation.

  • Ceteris Paribus Profiles: These profiles perform "what-if" analyses by showing how an individual's survival curve would shift if a single variable were changed while holding all others constant.
  • Break Down Plots: These plots decompose a single prediction to quantify the contribution of each variable to the survival probability at a specific time point.
BreakDown plot showing variable contributions to a single survival prediction.

Global Explanations

Global explainers provide insights into the overall behavior of the model across the entire dataset.

  • Variable Response Plots: Based on Partial Dependence Plots (PDP), these visualizations show the average effect of a variable on the survival curve across the population. This allows for direct comparison between different model architectures.
  • Model Performance Curves: These curves utilize time-dependent metrics like the Brier Score to visualize how a model's predictive error evolves over time, identifying periods where the model is most or least reliable.
Partial Dependency Plot comparing the effect of 'sex' across CoxPH, Random Forest, and SurvReg models.

Key Insights

The primary innovation of survxai is its treatment of the survival curve as the fundamental unit of explanation. By moving beyond single-point risk scores, the package allows researchers to visualize the entire predicted trajectory.

Furthermore, the structure-agnostic nature of the tool enables seamless comparison between models. As seen in the Partial Dependency Plots, one can visualize how a traditional Cox model differs from a complex Random Forest in its treatment of a specific feature. This comparison is vital for determining whether the added complexity of a machine learning model is justified by a more nuanced representation of the data.

Conclusion and Future Directions

survxai bridges the gap between high-performance survival modeling and human-interpretable clinical or engineering insights. While the current implementation excels at feature-by-feature analysis, the authors note that future work is needed to better handle complex feature interactions. As survival datasets grow in complexity, the ability to visualize multi-variable dependencies without sacrificing readability remains a key challenge for the field of survival XAI.

Summary updated

BibTeX
@article{grudziaz2018survxai,
  author = {Aleksandra Grudziaz and Alicja Gosiewska and Przemyslaw Biecek},
  title = {{survxai: an R package for structure-agnostic explanations of survival models}},
  journal = {J. Open Source Softw.},
  year = {2018},
  doi = {10.21105/joss.00961},
}
Figure