Abstract
Survival analysis models are commonly used in medicine and other areas. Many of them are too complex to be interpreted by human. Exploration and explanation is needed, but standard methods do not give a broad enough picture. 'survex' provides easy-to-apply methods for explaining survival models, both complex black-boxes and simpler statistical models. They include methods specific to survival analysis such as SurvSHAP(t) introduced in Krzyzinski et al., (2023), SurvLIME described in Kovalev et al., (2020) as well as extensions of existing ones described in Biecek et al., (2021).
Introduction
Survival analysis—predicting the time until an event occurs, such as a patient’s recovery or a mechanical failure—is a cornerstone of medicine and engineering. Traditionally, researchers relied on simple statistical models like Cox Proportional Hazards because they are easy to interpret. However, modern Machine Learning (ML) models like Random Survival Forests or Gradient Boosting often provide significantly better predictive accuracy.
The challenge lies in the "black-box" nature of these ML models. In high-stakes fields like healthcare, a model that identifies a patient as high risk without explaining why is often unusable. Standard Explainable AI (XAI) tools like SHAP or LIME are designed for simple classification and do not naturally handle the complexities of survival data, such as censoring and time-dependent feature importance.
The survex Framework
survex acts as a bridge between complex survival models and human-readable explanations. It provides a model-agnostic framework to peek inside these models, offering both global and local explanations that account for the unique time-dependent nature of survival data. The core of the package is the explain_survival() function, which provides a unified interface for models from various R libraries.
Key Methodologies
- SurvSHAP(t): An extension of SHAP that calculates feature contributions as a function of time, allowing users to see how a variable's influence changes over the survival horizon.
- SurvLIME: A survival-specific version of LIME that explains individual predictions by approximating the complex model with a simpler, interpretable local Cox model.
- Time-Dependent Profiles: The package extends classic tools like Partial Dependence Plots (PDP) to generate curves showing how changing a variable affects predicted survival probability across the entire timeline.
Performance Evaluation
survex doesn't just explain how a model works; it helps evaluate its performance using time-dependent metrics. This ensures that explanations are grounded in a model that is actually performing well.
Key metrics supported include the Brier Score and Cumulative/Dynamic AUC, both of which are essential for understanding model accuracy at different stages of the survival timeline.
Key Insights and Results
A critical insight provided by survex is that feature importance is rarely static. A feature might be a strong predictor for short-term survival but have zero impact on long-term outcomes. By providing both global explanations (population-wide) and local ones (individual-specific), the package builds a multi-layered understanding of model behavior. It integrates seamlessly with the DALEX ecosystem, providing standardized workflows for variable importance and diagnostic plots.
Limitations and Future Work
Methods like SurvSHAP(t) can be computationally expensive for very large datasets. Furthermore, the accuracy of explanations is inherently tied to how well the underlying model handles censored data. Future directions include more efficient SHAP estimation algorithms and broader support for emerging survival modeling frameworks in both R and Python.
Summary updated