# SurvTreeSHAP(t): scalable explanation method for tree-based survival models

Lucas Ducrot, Gilles Fevry, Clement Dano, Raphael Texier, Juliette Murris, Sandrine Katsahian

<figure><img src="image_1.png" /></figure>

To cite this version:

Lucas Ducrot, Gilles Fevry, Clement Dano, Raphael Texier, Juliette Murris, et al. SurvTreeSHAP(t): scalable explanation method for tree-based survival models. Workshop on Explainable Artificial Intelligence (XAI), IJCAI 2025, Aug 2025, Montreal, Canada. hal-05108033

HAL Id: hal-05108033

https://hal.science/hal-05108033v1

Submitted on 11 Jun 2025

HAL is a multi-disciplinary open access
archive for the deposit and dissemination of sci-
entific research documents, whether they are pub-
lished or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.

L'archive ouverte pluridisciplinaire HAL, est
destinée au dépôt et à la diffusion de documents
scientifiques de niveau recherche, publiés ou non,
émanant des établissements d'enseignement et de
recherche français ou étrangers, des laboratoires
publics ou privés.

<figure><img src="image_2.png" /></figure>

Distributed under a Creative Commons Attribution 4.0 International License
# SurvTreeSHAP(t) : scalable explanation method for tree-based survival models

Lucas Ducrot¹, Gilles Fevry², Clement Dano², Raphael Texier²,
Juliette Murris¹, Sandrine Katsahian¹,³

¹ HeKA, Inria Paris, Paris, France

² ENSAE, Palaiseau, France

³ URC, Hopital Européen Georges Pompidou, AP-HP, Paris, France

## Abstract

Tree-based survival models such as Random Survival Forests and Gradient Boosted Survival Trees offer state-of-the-art predictive performance for time-to-event data. However, their lack of interpretability limits their use in domains like health-care, where understanding individual risk is crucial. SHAP method and a survival-specific extension SurvSHAP(t), have emerged as promising tools for feature attribution. Yet, their applicability remains limited in high-dimensional settings due to computational inefficiencies. TreeSHAP allows scalable explanation for tree-based models but does not support survival setting. We present SurvTree-SHAP(t), a scalable interpretability method tailored to tree-based survival models. Combining TreeSHAP and SurvSHAP(t), our approach allows a scalable computation time. Feature contributions are computed efficiently and aggregated over time to provide meaningful, individual and global insights into survival predictions. Through simulations and real-world clinical data, we show that our method produces reliable explanations while maintaining scalability across hundreds of variables. This work enables interpretable and efficient survival modeling at scale, with practical implications for clinical decision-making and large-scale biomedical applications.

## 1 Introduction

In healthcare, predictive models shall not only provide accurate survival estimates but also offer transparent reasoning behind their predictions [Stiglic et al., 2020]. Both regulators, clinicians and patients require this interpretability to inform critical decisions such as treatment switch or follow-up planning [Farah et al., 2023].

Survival analysis, which models the time until an event of interest (e.g., death, relapse, or treatment failure), is a cornerstone of medical statistics. While traditional models like the Cox proportional hazards (CPH) model [Cox, 1972] provide interpretable hazard ratios and are widely used, they rely on restrictive assumptions such as proportional hazards and linear effects, which may not hold in complex biomedical datasets [Moncada-Torres et al., 2021].

In contrast, modern machine learning approaches, particularly tree-based ensemble methods, offer more flexible modeling capabilities [Grinsztajn et al., 2022].

Random Survival Forests (RSF) [Ishwaran et al., 2008] and Gradient Boosted Survival Trees (GBSTs) [Chen and Guestrin, 2016] can capture complex interactions and nonlinear effects in high-dimensional settings. However, the complexity of these models comes at the cost of transparency. Without interpretability tools, their predictions remain difficult to trust and adopt in clinical workflows [Rosenbacke et al., 2024; Murris, 2024]. Moreover, their usage in regulatory contexts (e.g. approval of predictive algorithms by health authorities) necessitates explainable outputs [Fraser et al., 2023; Health, Fri 10202023 1247; Muralidharan et al., 2024; Gilbert, 2024].

To address this, a family of post-hoc explanation methods has emerged, aiming to attribute model outputs to input features in an interpretable way. SHAP (SHapley Additive exPlanations) [Lundberg and Lee, 2017] has become a gold standard for feature attribution. However, the direct application of SHAP to survival data is non-trivial because predictions are time-dependent. The SurvSHAP(t) method [Krzyziński et al., 2023] extends SHAP to survival settings by generating time-indexed attributions, but remains computationally intensive and struggles with scalability for large datasets.

TreeSHAP [Lundberg et al., 2019] provides a fast algorithm to compute SHAP values in polynomial time for tree ensembles, but its application has been limited to regression and classification tasks. This creates a critical gap in the field as scalable, reliable explanation methods optimized for tree-based survival models remain elusive.

In this work, we introduce SurvTreeSHAP(t), a novel method that leverages the hierarchical structure of tree ensembles to provide efficient, time-dependent explanations of survival predictions. By adapting the TreeSHAP algorithm to accommodate survival functions, our method enables interpretable and scalable survival modeling. We validate our approach on both synthetic data and real-world clinical datasets, benchmarking its computational performance and explanation quality against existing methods.
## 2 Background

### 2.1 Survival Analysis with covariates

In survival analysis, the primary objective is to model the time until the occurrence of a specific event of interest, such as death, failure, or relapse. Let $T \in \mathbb{R}^+$ denote the time to event and covariate information for each individual is represented by a vector $X \in \mathbb{R}^p$.

The survival function $S(t|X)$ is defined as the conditional probability that the event has not occurred by time $t$ given the covariates $X$:

$$S(t|X) = \mathbb{P}(T > t | X).$$

The hazard function $h(t|X)$ describes the instantaneous risk of experiencing the event at time $t$, conditional on survival up to $t$:

$$h(t|X) = \lim_{\Delta t \to 0} \frac{\mathbb{P}(t \le T < t + \Delta t | T \ge t, X)}{\Delta t}.$$

and it is related to the survival function via:

$$S(t|X) = \exp \left( - \int_{0}^{t} h(s|X) ds \right).$$

### 2.2 SHAP

SHAP (SHapley Additive exPlanations) is a unified framework for interpreting machine learning predictions based on the concept of Shapley values from cooperative game theory [Lundberg and Lee, 2017]. In this context, the prediction model $f$ is viewed as a game, and each input variable corresponds to a "player" that contributes to the prediction outcome.

The goal of SHAP is to compute, for a given instance $x$, the contribution $\phi_j$ of each feature $x_j$ to the model prediction $f(x)$. SHAP explanations satisfy an additive feature attribution form:

$$f(x) = \phi_0 + \sum_{j=1}^{p} \phi_j,$$

where $\phi_0$ is the expected model output $E[f(X)]$, and $\phi_j$ represents the marginal contribution of feature $j$ to the prediction.

The SHAP value $\phi_j$ for feature $j$ is computed by averaging over all possible subsets $C \subseteq \{1, \dots, p\} \setminus \{j\}$ of input features that do not contain $j$, as follows:

$$\phi_j = \sum_{C \subseteq \{1, \dots, p\} \setminus \{j\}} \frac{|C|!(p - |C| - 1)!}{p!} [f_{C \cup \{j\}}(x_{C \cup \{j\}}) - f_C(x_C)],$$

where $f_C(x_C)$ denotes the expected prediction conditioned on the features in subset $C$, i.e., $f_C(x_C) = E[f(X) | X_C = x_C]$. The naive implementation of SHAP (KernelSHAP) has exponential complexity $O(2^p)$, making it computationally prohibitive for high-dimensional data without specialized approximation techniques.

### 2.3 TreeSHAP: efficient SHAP for trees

TreeSHAP addresses the computational challenges of SHAP for tree-based models by exploiting their hierarchical structure to compute exact SHAP values in polynomial time [Lundberg et al., 2019]. For tree ensembles where $f(x) = \sum_{m=1}^{M} f^{(m)}(x)$, TreeSHAP computes feature attribution values $\phi_j^{(m)}$ for each individual tree and then aggregates them:

$$\phi_j = \sum_{m=1}^{M} \phi_j^{(m)}$$

The algorithm's key innovation lies in recursively tracking the proportion of feature coalitions that follow specific paths through each tree, weighted according to the SHAP kernel. At each node, the algorithm computes conditional expectations by distributing contributions between child nodes based on feature presence or absence in potential coalitions.

By leveraging the tree structure, TreeSHAP achieves polynomial complexity $O(TLD^2)$, where $T$ is the number of trees, $L$ is the average number of leaves per tree, and $D$ is the maximum tree depth. This dramatic efficiency improvement enables practical explanations for complex tree ensembles with many features.

### 2.4 SurvSHAP(t): Time-dependent explanations for survival models

SurvSHAP(t) is a model-agnostic explanation method that extends KernelSHAP to survival models by producing local additive feature attributions for the predicted survival probability at a given time $t$ [Krzyziński et al., 2023]. The idea of SurvSHAP(t) is to treat the predicted survival probability at a fixed time $t$, denoted $\hat{S}(t|X)$, as the scalar output to be explained. Given $X \in \mathbb{R}^p$ and a survival model, SurvSHAP(t) uses KernelSHAP to approximate the Shapley values $\phi_j(t)$ such that:

$$\hat{S}(t|X) = \phi_0(t) + \sum_{j=1}^{p} \phi_j(t),$$

where $\phi_0(t) = E[\hat{S}(t|X)|X]$ is the expected survival at time $t$, and $\phi_j(t)$ is the marginal contribution of feature $j$ to the survival prediction at that time. The exponential complexity of SurvSHAP(t) is inherited from KernelSHAP multiplied by $K$ the number of time points, therefore in $O(K \cdot 2^p)$. On RSF, SurvSHAP(t)'s complexity becomes $O(K \cdot TL2^p)$ with $T$ is the number of trees, $L$ is the number of leaves per tree.

## 3 Method

### 3.1 SurvTreeSHAP(t): Overview and motivation

We propose SurvTreeSHAP(t), a novel adaptation of TreeSHAP for interpreting survival models. In our approach, we compute SHAP values at each time point $t$ for a given instance by applying the TreeSHAP algorithm to the predicted survival probability $\hat{S}(t|X)$. This is achieved by modifying the original TreeSHAP implementation to treat the survival prediction at a fixed time $t$ as a scalar output, allowing exact and efficient computation of SHAP values over time.
**SurvTreeSHAP(t)** is model-specific and leverages the internal structure of tree-based survival models - like RSF - to enable fast, consistent attribution of covariate contributions to predicted survival functions. For each time point in a predefined grid, TreeSHAP is applied separately to compute local feature attributions $\phi_j(t)$, resulting in time-dependent explanation curves. Our implementation modifies the open-source TreeSHAP codebase from the *shap* Python package to support survival-specific outputs.

**Computational complexity** For a single time point, **SurvTreeSHAP(t)** inherits TreeSHAP's complexity of $O(TLD^2)$. Across all $K$ time points, the total complexity is $O(K \cdot TLD^2)$. This represents a significant improvement over SurvSHAP(t)'s complexity on trees which is $O(K \cdot TL2^p)$ (on datasets with many features).

## 3.2 Evaluation of SurvTreeSHAP(t)

**Simulated data** We evaluate **SurvTreeSHAP(t)** both in terms of scalability and interpretability. To assess scalability, we generate simulated datasets based on a CPH model with varying numbers of covariates. We train random survival forests with different hyperparameter settings - including the number of trees and maximum depth - and measure computation time when producing SHAP explanations over time.

**Real-world clinical data** To assess interpretability in a clinical context, we apply **SurvTreeSHAP(t)** to the German Breast Cancer Study Group (GBSG) dataset [Schumacher et al., 1994], which includes survival outcomes for 686 individuals along with eight clinical covariates. After applying one-hot encoding to categorical variables, we compared the performance of a RSF and a CPH model trained on the same features. The evaluation was carried out using two standard survival metrics: the concordance index (C-index) and the integrated Brier score (IBS). Using our **SurvTreeSHAP(t)** method, we then generated individualized, time-dependent explanations of survival predictions, aiming to identify and interpret key clinical factors influencing risk over time.

# 4 Results

## 4.1 On simulated data

**Scalability analysis** We compared runtime of **SurvTreeSHAP(t)** and Kernel SurvSHAP(t) across datasets simulated from a CPH model with an increasing number of covariates (ranging from $p = 1$ to $p = 14$). For each dataset configuration, we measured the total computation time required to generate time-dependent SHAP values across 400 time points for a single individual. The RSF used for explanation were trained with consistent hyperparameters: {$n\_estimators = 100, max\_depth = 10$ and $max\_leaf\_nodes = 20$}.

As shown in Figure 1, **SurvTreeSHAP(t)** demonstrates a near-linear increase in runtime as the number of covariates grows, maintaining computational efficiency between 1-2 seconds even at $p = 14$ covariates. In contrast, Kernel SurvSHAP(t) exhibits exponential growth in computation time, exceeding 400 seconds when $p = 14$.

These results confirm that **SurvTreeSHAP(t)** offers substantial scalability improvements that make it feasible for routine application in moderate to high-dimensional clinical datasets where Kernel SurvSHAP(t) would be prohibitively expensive.

224
225
226
227
228

<figure><img src="image_3.png" /><figcaption>Figure 1: Computation time function of number of covariates on 1 patient - **SurvTreeSHAP(t)** vs Kernel SurvSHAP(t).</figcaption></figure>

**Quality of explanations** To evaluate the explanation quality, we simulated a dataset of 1,000 individuals under a CPH model with six covariates, each associated with distinct effect sizes: $\beta = [6, 4, 2, 1, 0.5, 0.1]$. A RSF was trained on 80% of the data using the following hyperparameters: $n\_estimators = 100, max\_depth = 10$. The resulting model achieved strong discriminative performance on the held-out test set with a C-index of 0.881.

229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247

Figure 2 shows the frequency distribution of importance rankings for each covariate, aggregated across all test individuals. The rankings show strong alignment with the true effect sizes from the simulation: the covariate with the largest simulated effect (cov_0, $\beta = 6$) was most frequently ranked first in importance, while the covariate with the smallest effect (cov_5, $\beta = 0.1$) consistently appeared at lower ranks.

These results validate that **SurvTreeSHAP(t)** produces explanations that correctly identify the relative influence of features, even when mediated through a complex tree ensemble model.

<figure><img src="image_4.png" /><figcaption>Figure 2: Global importance ranking of covariates aggregated over 200 individuals.</figcaption></figure>
References 320

[Chen and Guestrin, 2016] Tianqi Chen and Carlos Guestrin. XGBoost: A Scalable Tree Boosting System. In *Proceedings of the 22nd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining*, pages 785–794, August 2016.

[Cox, 1972] D. R. Cox. Regression Models and Life-Tables. *Journal of the Royal Statistical Society: Series B (Methodological)*, 34(2):187–202, 1972.

[Farah et al., 2023] Line Farah, Juliette M. Murris, Isabelle Borget, Agathe Guilloux, Nicolas M. Martelli, and Sandrine I. M. Katsahian. Assessment of Performance, Interpretability, and Explainability in Artificial Intelligence-Based Health Technologies: What Healthcare Stakeholders Need to Know. *Mayo Clinic Proceedings: Digital Health*, 1(2):120–138, June 2023.

[Fraser et al., 2023] Alan G. Fraser, Elisabetta Biasin, Bart Bijnens, Nico Bruining, Enrico G. Caiani, Koen Cobbaert, Rhodri H. Davies, Stephen H. Gilbert, Leo Hovestadt, Erik Kamenjasevic, Zuzanna Kwade, Gearóid McGauran, Gearóid O’Connor, Baptiste Vasey, and Frank E. Rademakers. Artificial intelligence in medical device software and high-risk medical devices - a review of definitions, expert recommendations and regulatory initiatives. *Expert Review of Medical Devices*, 20(6):467–491, June 2023.

[Gilbert, 2024] Stephen Gilbert. The EU passes the AI Act and its implications for digital medicine are unclear. *npj Digital Medicine*, 7(1):1–3, May 2024.

[Grinsztajn et al., 2022] Léo Grinsztajn, Edouard Oyallon, and Gaël Varoquaux. Why do tree-based models still outperform deep learning on tabular data?, July 2022.

[Health, Fri 10202023 1247] Center for Devices and Radiological Health. Good Machine Learning Practice for Medical Device Development: Guiding Principles. FDA, Fri, 10/20/2023 - 12:47.

[Ishwaran et al., 2008] Hemant Ishwaran, Udaya B. Kogalur, Eugene H. Blackstone, and Michael S. Lauer. Random survival forests. *The Annals of Applied Statistics*, 2(3), September 2008.

[Krzyziński et al., 2023] Mateusz Krzyziński, Mikołaj Spytek, Hubert Baniecki, and Przemysław Biecek. SurvSHAP(t): Time-dependent explanations of machine learning survival models. *Knowledge-Based Systems*, 262:110234, February 2023.

[Lundberg and Lee, 2017] Scott Lundberg and Su-In Lee. A Unified Approach to Interpreting Model Predictions, November 2017.

[Lundberg et al., 2019] Scott M. Lundberg, Gabriel G. Erion, and Su-In Lee. Consistent Individualized Feature Attribution for Tree Ensembles, March 2019.

[Moncada-Torres et al., 2021] Arturo Moncada-Torres, Marissa C. van Maaren, Mathijs P. Hendriks, Sabine Siesling, and Gijs Geleijnse. Explainable machine learning can outperform Cox regression predictions and provide insights in breast cancer survival. *Scientific Reports*, 11(1):6968, March 2021.

[Muralidharan et al., 2024] Vijaytha Muralidharan, Boluwatife Adeleye Adewale, Caroline J. Huang, Mfon Thelma Nta, Peter Oluwaduyilemi Ademiju, Pirunthan Pathmarajah, Man Kien Hang, Oluwafolajimi Adesanya, Ridwanullah Olamide Abdullateef, Abdulhammed Opeyemi Babatunde, Abdulquddus Ajibade, Sonia Onyeka, Zhou Ran Cai, Roxana Daneshjou, and Tobi Olatunji. A scoping review of reporting gaps in FDA-approved AI medical devices. *NPJ Digital Medicine*, 7:273, October 2024.

[Murris, 2024] Juliette Murris. Tree-based approaches for interpretable modeling in healthcare. In *Proceedings of the AAAI/ACM Conference on AI, Ethics, and Society*, volume 7, pages 37–39, 2024.

[Rosenbacke et al., 2024] Rikard Rosenbacke, Åsa Melhus, Martin McKee, and David Stuckler. How explainable artificial intelligence can increase or decrease clinicians’ trust in ai applications in health care: Systematic review. *JMIR AI*, 3:e53207, 2024.

[Schumacher et al., 1994] M. Schumacher, G. Bastert, H. Bojar, K. Hübner, M. Olschewski, W. Sauerbrei, C. Schmoor, C. Beyerle, R. L. Neumann, and H. F. Rauschecker. Randomized 2 x 2 trial evaluating hormonal treatment and the duration of chemotherapy in node-positive breast cancer patients. German Breast Cancer Study Group. *Journal of Clinical Oncology: Official Journal of the American Society of Clinical Oncology*, 12(10):2086–2093, October 1994.

[Stiglic et al., 2020] Gregor Stiglic, Primoz Kocbek, Nino Fijacko, Marinka Zitnik, Katrien Verbert, and Leona Cilar. Interpretability of machine learning-based prediction models in healthcare. *WIREs Data Mining and Knowledge Discovery*, 10(5):e1379, 2020.

[Vigna, 2015] Sebastiano Vigna. A Weighted Correlation Index for Rankings with Ties. In *Proceedings of the 24th International Conference on World Wide Web*, WWW ’15, pages 1166–1176, Republic and Canton of Geneva, CHE, May 2015. International World Wide Web Conferences Steering Committee.