Source-linked AI summary

SurvSHAP(t): Time-dependent explanations of machine learning survival models

Mateusz Krzyziński, Mikołaj Spytek, Hubert Baniecki, Przemysław Biecek

arXiv:2208.11080v2cs.LGcs.AIstat.ML

TL;DR

Machine-learning survival models are difficult to interpret, and existing methods do not directly explain survival-function predictions over time. SurvSHAP(t) provides time-dependent SHAP attributions for survival models; experiments report detection of time-dependent effects and better aggregated variable importance than SurvLIME. Its practical use is bounded by inherited SHAP drawbacks and computational cost.

  • Problem

    Existing survival explainers do not directly explain survival-function predictions over time, although complex survival models are difficult to interpret.

    Source: §1 · p. 1
  • Method

    SurvSHAP(t) extends SHAP to provide time-dependent variable attributions for survival models with functional output.

    Source: §1 · p. 2
  • Results

    Experiments report that SurvSHAP(t) detects variables with time-dependent effects and that its aggregation determines prediction-specific variable importance better than SurvLIME.

    Source: §1 · p. 2
  • Takeaways & Limitations

    The explanations may help interpret critical decisions, understand model operation, and generate domain knowledge in medical time-to-event analyses.

    Source: §6.3 · p. 12

    SurvSHAP(t) may be misleading for non-additive models, and computing Shapley values across many time points is time-consuming.

    Source: §7 · p. 14

Abstract

from arXiv · show

Machine and deep learning survival models demonstrate similar or even improved time-to-event prediction capabilities compared to classical statistical learning methods yet are too complex to be interpreted by humans. Several model-agnostic explanations are available to overcome this issue; however, none directly explain the survival function prediction. In this paper, we introduce SurvSHAP(t), the first time-dependent explanation that allows for interpreting survival black-box models. It is based on SHapley Additive exPlanations with solid theoretical foundations and a broad adoption among machine learning practitioners. The proposed methods aim to enhance precision diagnostics and support domain experts in making decisions. Experiments on synthetic and medical data confirm that SurvSHAP(t) can detect variables with a time-dependent effect, and its aggregation is a better determinant of the importance of variables for a prediction than SurvLIME. SurvSHAP(t) is model-agnostic and can be applied to all models with functional output. We provide an accessible implementation of time-dependent explanations in Python at http://github.com/MI2DataLab/survshap.

1 Introduction

Complex survival models can predict flexibly but are difficult to interpret, while existing survival explainers do not retain the time dimension. SurvSHAP(t) extends SHAP to explain variable effects on survival functions over time.

1 Introduction

  • Complex machine-learning models obscure which inputs influence predictions, limiting trust and adoption in settings such as medicine.The introduction notes that less-performing but more familiar models may still be preferred.Source: §1 · p. 1
  • Flexible machine-learning survival models motivate explanation methods because Cox models have limitations and assumptions that are often unmet.Cox models can struggle with complex dependencies.Source: §1 · pp. 1–2
  • Existing post-hoc survival explainers do not include time in their final explanations, despite its importance to survival distributions.Source: §1 · p. 2
  • SurvSHAP(t) applies SHAP to functional-output models, explaining variable influence on survival predictions at each time point.The paper reports that it satisfies local accuracy and that experiments show time-dependent effects can be detected; its aggregation outperforms SurvLIME for variable importance.Source: §1 · p. 2

2 Related work

Related work spans flexible survival prediction models and general-purpose explainers, but existing adaptations often reduce survival predictions to single values. SurvSHAP(t) instead explains the survival function across time.

2 Related work

  • Classical Cox models have limitations, motivating machine-learning survival methods such as Random Survival Forests and flexible deep-learning models.The passage also notes that relatively few survival deep-learning models have open-source implementations.Source: §2 · p. 3
  • General model explanations include local and global methods, with LIME and SHAP among widely used local additive attribution approaches.LIME fits a local surrogate, while SHAP uses Shapley values to measure feature contributions relative to a baseline.Source: §2 · p. 3
  • Survival adaptations using single-point risks or aggregated functions lose distributional information, whereas SurvSHAP(t) explains the whole survival function.SurvLIME uses a Cox surrogate fitted to cumulative hazard functions but returns single coefficients rather than time-dependent attributions.Source: §2 · pp. 3–4
  • The paper identifies missing time-dependent explanations and public implementations as gaps, and presents SurvSHAP(t) with an implementation.Source: §2 · p. 4

3 Preliminaries

The preliminaries establish how survival data and predictions are represented, then introduce variable ranking for Cox and SurvLIME comparisons.

3.1 Mathematical background of survival analysis

  • Right censoring means the event is unobserved for some individuals, while the survival function gives the probability of surviving to time t and relates to the hazard and cumulative hazard.Aggregating a survival function can also yield single-value predictions such as time-to-event or risk scores.Source: §3.1 · pp. 4–5

3 Preliminaries

  • A survival observation is represented by covariates, an observed time, and an event indicator; censored observations have latent survival times, and predictions are often functions of time.Source: §3.1 · p. 4

3.2 Variable importance ranking in CPH and SurvLIME

  • For Cox-model variable ranking, the absolute coefficient multiplied by the instance's variable value is used, with larger values indicating greater importance.This ranking is used in comparisons with SurvLIME because its explanations are Cox coefficients.Source: §3.2 · p. 5

4 Time-dependent explanations of machine learning survival models

SurvSHAP(t) assigns each feature a contribution to the predicted survival function at each time point. The paper describes Shapley-based estimation strategies, aggregation, and retained SHAP properties.

4 Time-dependent explanations of machine learning survival models

  • For a survival model with functional output, SurvSHAP(t) returns a survival function for each instance and time-dependent attribution functions for its predictors.The attributions describe how variables influence the model prediction across the analyzed times.Source: §4 · p. 5
  • The Shapley sampling approach estimates a predictor's contribution from changes in expected model output across feature orderings.The method can normalize values to a common scale; high-dimensional models use permutation sampling because of computational cost.Source: §4 · p. 5
  • A second estimator uses Shapley-kernel-weighted linear regression, fitting feature attributions to model-predicted survival functions for sampled coalitions.The coalition matrix encodes feature presence, and the resulting rows of Φ explain individual variables.Source: §4 · pp. 5–6
  • The algorithm is stated to preserve local accuracy, missingness, and consistency for time-dependent explanations.Source: §4 · p. 6
  • Aggregating the time-dependent attributions provides variable-importance values for an observation.Source: §4 · p. 6

5 Evaluation metrics

The section introduces metrics for explanation quality, covering local accuracy, time-varying effects, importance rankings, agreement with ground-truth Shapley values, and variable-specific explanation difficulty.

5 Evaluation metrics

  • Local accuracy measures the normalized standard deviation of the difference between the black-box output and its explanation; lower values indicate closer agreement, and methods meeting local accuracy score zero.The metric is evaluated at each time point.Source: §5 · p. 6
  • Changing Sign Proportion (CSP) measures the fraction of observations whose variable attribution is positive and negative for at least α of the selected time period.CSP should be higher for variables with time-dependent effects than for constant effects, and zero for models such as CPH that do not account for time-dependent effects.Source: §5 · p. 6
  • Additive hyperbolic Kendall’s τh measures the correlation between explanation-based variable-importance rankings and known ground-truth orderings, averaged across analyzed observations.The ground-truth orderings are described in Section 3.2.Source: §5 · p. 6
  • GT-Shapley adapts to compare explanations with ground-truth Shapley values at each time point, using reference values obtained with N=10000 same-distribution background observations.Source: §5 · pp. 6–7
  • An additional residual-based metric assesses how difficult it is for SurvSHAP(t) to explain a given variable.Source: §5 · p. 7

6 Experiments

The experiments assess local accuracy and time-dependent effects on synthetic data, compare SurvSHAP(t) with SurvLIME, and examine heart-failure survival models. They report stronger global ranking aggregation than SurvLIME and show that explanations can expose time-varying effects and differences between models.

6.1 Evaluating explanations on synthetic data

  • For synthetic x(1), SurvSHAP(t) showed the time-varying effect in RSF explanations but not CPH explanations.The effect was positive early and negative later; RSF also assigned part of the changing impact to other variables, consistent with difficulty separating its source.Source: §6.1 · p. 8, Figure 3 · p. 8
  • Synthetic-data local-accuracy errors were on the order of 10^-7, and high GT-Shapley scores indicated stable explanations as the estimation sample grew.Local-accuracy errors rose over time, which the authors relate to poorer prediction near the end of the examined period when many observations are censored.Source: §6.1 · pp. 8–9, Figure 4 · p. 9, Figure 5 · p. 9
  • Explanation accuracy was harder to assess for time-dependent x(1); the large CPH normalized-RMSE value for near-zero x(5) attributions may reflect numerical error.The authors suspect a larger background of observations may be needed to explain time-dependent variables correctly.Source: Figure 6 · p. 9, §6.1 · p. 9

6.2 Comparison to SurvLIME

  • SurvSHAP(t) preserved local accuracy while SurvLIME did not, and its local variable-importance rankings better matched the Cox-model ground-truth ranking.The comparison used average additive hyperbolic Kendall’s τh correlations across test observations.Source: §6.2 · p. 10, Table 2 · p. 10
  • Across 100 test predictions, SurvSHAP(t) preserved variable rankings more distinctly than SurvLIME, whose dataset0 rankings were nearly uniform.The rankings are aggregated across observations; the black-box ranking is approximated with permutation importance using integrated Brier score as the loss.Source: Figure 9 · p. 11, §6.2 · p. 11

6.3 Real-world use case: predicting survival of patients with heart failure

  • For one heart-failure patient, ejection-fraction importance increased over time, while platelet attributions differed between models.The authors suggest in-depth analysis can help a physician decide which prediction is more adequate.Source: Figure 11 · p. 12, Figure 12 · p. 12, §6.3 · p. 13
  • For the real-world sample, ground-truth Shapley values were difficult to obtain and binary variables precluded the Cox-model importance definition, so rankings were approximated by permutation importance.The comparison uses aggregated SurvSHAP(t) rankings and Cox-model rankings from SurvLIME.Source: §6.3 · p. 13
  • In heart-failure RSF predictions, aggregation ranked ejection fraction and serum creatinine most often (260 times total), consistent with their similar global importance.Their mean increases in integrated Brier score after permutation were 0.0456 and 0.0454, respectively.Source: Figure 13 · p. 13, §6.3 · p. 13

7 Discussion

SurvSHAP(t) explains survival functions with time-dependent variable attributions and differs from SurvLIME’s Cox-surrogate approach. Its practical use is supported by a Python implementation, while inherited SHAP drawbacks and computation costs remain.

7 Discussion

  • SurvSHAP(t) is the first Shapley-value method to provide time-dependent explanations of survival functions for a broad class of models.It presents each variable’s importance as a function over time.Source: §7 · p. 14
  • Unlike SurvLIME, SurvSHAP(t) avoids a Cox-model surrogate and can explain variables whose effects change over time.SurvLIME returns single coefficients that do not directly indicate importance; SurvSHAP(t) presents importance explicitly at each time point.Source: §7 · p. 14
  • The Python implementation includes SurvSHAP(t) and SurvLIME, is tailored to scikit-survival models, and provides plots showing variable influence at chosen times.The plots are intended to be intuitive for users without prior XAI experience.Source: §7 · p. 14
  • SurvSHAP(t) inherits SHAP’s risk of misleading attributions for non-additive models, and evaluating many time points increases its computation cost.The paper notes that Shapley-value computation is time-consuming, with the burden amplified by calculations across time.Source: §7 · p. 14

8 Conclusion

The paper presents and validates SurvSHAP(t) for survival-model explanations, with source code and experiments contributed. It highlights time-dependent function outputs and potential use by domain stakeholders, while identifying global explanations as future work.

8 Conclusion

  • SurvSHAP(t) is a local variable-attribution method with theoretical guarantees such as local accuracy, illustrated on synthetic data and a real-life use case.The paper also compares it with SurvLIME and contributes the method’s source code, experiments, and SurvLIME code.Source: §8 · p. 14
  • SurvSHAP(t) presents final explanations as time-dependent functions and could be generalized to models with any functional output.Aggregating its functions across a data distribution is proposed as future work for global explanations.Source: §8 · p. 14
  • The authors identify physicians and bioinformaticians as potential beneficiaries of accessible visualizations and recommend applying the method to RSF and deep-learning models.They recommend these applications in scenarios where practice previously considered only CPH models.Source: §8 · p. 14
Loading 2208.11080v2…