Source-linked AI summary

DynSHAP: Towards Explainable Dynamic Survival Analysis

Nastasya Anokhina, Jonas Jürß, Pietro Liò

arXiv:2609.13042v1cs.LGcs.AI

TL;DR

Existing explainability methods do not jointly handle irregular longitudinal inputs and functional survival outputs in dynamic survival analysis. DynSHAP treats time–feature pairs as Shapley players and adds conditional sampling based on learned temporal dependencies. Temporal DynSHAP recovers temporally dependent ground-truth features better than marginal estimators for DySurv, while DynSHAP explanations outperform baselines on synthetic and PBC faithfulness tests.

  • Problem

    Existing explainability methods do not jointly handle irregular longitudinal inputs and functional survival outputs in dynamic survival analysis.

    Source: §1 · p. 1, §2 · p. 3
  • Method

    DynSHAP treats time–feature pairs as Shapley players, and Temporal DynSHAP conditions out-of-coalition values on learned temporal dependencies.

    Source: §1 · p. 2, §3.1 · p. 3, §3.2 · p. 4
  • Results

    Temporal DynSHAP recovers ground truth about 2× better than marginal counterparts on DySurv, but this advantage does not hold for DDH; the methods outperform baselines on synthetic and PBC faithfulness tests.

    Source: §4.1 · p. 5, §4.2 · p. 5
  • Takeaways & Limitations

    The explanations identify which patient information drove survival predictions and when, with real-data attributions reported as consistent with established clinical findings.

    Source: §1 · p. 2, §4.2 · p. 6

    Temporal DynSHAP assumes linear dependencies over time, which may create spurious correlations or miss longer-range dependencies.

    Source: §4.2 · p. 6

Abstract

from arXiv · show

Deep learning models for dynamic survival analysis (DSA) achieve strong predictive performance by incorporating longitudinal patient data, but their black box nature limits clinical trust and adoption. Existing explainability methods cannot handle longitudinal, irregular inputs and functional survival outputs simultaneously, which limits their usability in DSA. We propose DynSHAP, a SHAP framework suited specifically for dynamic survival analysis. It extends common marginal SHAP estimators to this setting by treating time--feature pairs as players in the Shapley game. We further introduce Temporal DynSHAP, which learns linear dependencies in features over time and uses conditional sampling to address them in explanations. When applied to synthetic data with known ground-truth attributions, Temporal DynSHAP recovers temporally dependent features more accurately than marginal estimators for a given state-of-the-art model. Applied to two real-world clinical datasets and two DSA architectures, DynSHAP produces attributions faithful to model learning, allowing medical experts to see which patient information drove the prediction and when.

1 Introduction

Dynamic survival analysis uses longitudinal patient data, but existing explainability methods do not jointly handle irregular inputs and functional survival outputs. DynSHAP treats time–feature pairs as Shapley players and introduces a temporal estimator to address dependencies across time.

1 Introduction

  • Existing explainability methods do not handle irregular longitudinal inputs and functional survival outputs together, leaving a gap for dynamic survival analysis.The gap matters in healthcare, where visits and disease progression form dynamic trajectories.Source: §1 · p. 1
  • DynSHAP discretises time into time–feature pairs and extends marginal SHAP estimators to explain longitudinal inputs and functional survival outputs.Temporal DynSHAP additionally conditions on learned feature dependencies across time rather than sampling out-of-coalition values independently.Source: §1 · p. 2
  • The framework includes a Python package, and its real-world applications recover attributions consistent with established clinical findings.Its local explanations show which time–feature pairs add to or take away from a survival prediction.Source: §1 · p. 2, Figure 1 · p. 2

2 Related Work

Prior SHAP extensions address time series or survival outputs separately, but do not jointly handle irregular longitudinal data and survival conventions. Marginal sampling may also produce unrealistic instances and miss temporal dependence.

2 Related Work

  • Marginal SHAP simulates absent features with background samples, which can create unrealistic data points when features are correlated [5].Conditional SHAP extensions have been developed to address this correlation problem.Source: §2 · p. 2
  • Time-series segmentation treats segments as players but omits feature-level importance, while landmarking followed by SHAP does not capture feature evolution over time [12].WindowSHAP [7] and TimeSHAP use window-grouping; SurvSHAP(t) handles functional survival outputs.Source: §2 · pp. 2–3
  • Existing methods do not jointly handle irregular time series and survival output conventions, leaving dynamic survival analysis without a directly applicable SHAP approach.Irregular clinical visits and disease progression make explanations of temporal histories relevant to timely predictions.Source: §2 · p. 3
  • Marginal sampling may miss dependence on previously observed information and produce recency bias by over-attributing the last timestamp.Unrealistic counterfactuals can lead to unreliable model predictions that propagate into SHAP estimates.Source: §2 · p. 3

3 Methods

DynSHAP represents irregular patient histories as time–feature players and estimates their contributions to survival predictions. Temporal DynSHAP modifies the value function to condition out-of-coalition values on learned temporal dependencies, under a linear-dependence assumption.

3.1 Problem Setup

  • Each patient’s measurements are aggregated as means within time bins, and each time–feature pair becomes an independent player so attributions can vary over time.The feature-player space has size P = K × M, where K is the number of bins and M the number of features.Source: §3.1 · p. 3, Figure 2 · p. 3
  • DynSHAP estimates separate SHAP values at each prediction horizon rather than collapsing the survival function to one scalar.The marginal value function averages predictions over hybrid observations that combine target and background values.Source: §3.1 · p. 3, §3.2 · p. 4

3.2 Marginal Estimators

  • The Monte Carlo estimator averages a player’s marginal contribution across random permutations, while Kernel DynSHAP fits Shapley values from sampled coalition masks using weighted least squares.For a mask, present pairs retain target values and absent pairs take background values at corresponding visits.Source: §3.2 · pp. 3–4

3.3 Temporal DynSHAP

  • Temporal DynSHAP assumes linear dependence between features over time and replaces independent marginal sampling with conditional sampling of out-of-coalition pairs.It keeps target values for in-coalition pairs and averages over conditional draws; the method uses a linear Gaussian model, sampling the initial time bin marginally.Source: §3.3 · p. 4

4 Experiments

The experiments evaluate DynSHAP on synthetic data with known attributions and on real clinical datasets, testing recovery and faithfulness. Temporal DynSHAP improves ground-truth recovery for DySurv but not DDH, while DynSHAP outperforms baselines on synthetic and PBC faithfulness tests.

4 Experiments

  • The experiments evaluated Dynamic-DeepHit and DySurv on synthetic data and two real-world datasets; the synthetic dataset used four covariates designed to test temporal dependence.Both models exceeded 0.7 concordance index on all datasets.Source: §4 · p. 4, §4.1 · p. 4

4.1 Temporal Dependence Recovery

  • Temporal DynSHAP recovered synthetic ground-truth SHAP about 2× better than marginal counterparts on DySurv, but this advantage did not hold for DDH.All methods performed substantially worse on DDH, which may indicate that DDH failed to learn the dataset’s linear feature correlations.Source: Table 1 · p. 5, §4.1 · p. 5

4.2 Practical Applications

  • The practical goal is to provide timely clinical-marker attributions for potential early intervention and help technicians infer model learning and revise architectures.Evaluating explanations on real-world data is challenging because ground truth is unavailable.Source: §4.2 · p. 5
  • Kernel DynSHAP performed better than Temporal DynSHAP on DySurv faithfulness, while Temporal DynSHAP’s linear-dependence assumption may create spurious correlations or miss longer-range dependencies.The faithfulness metrics favor marginal approaches because they replace masked features with background data.Source: Table 2 · p. 6, §4.2 · p. 6
  • DynSHAP outperformed baselines in faithfulness tests on synthetic and PBC data, while MS results were noisier, possibly due to data sparsity.The test progressively removes top-ranked clusters of time–feature pairs and measures changes in model predictions.Source: §4.2 · p. 5, Figure 4 · p. 6
  • On PBC, both estimators highlighted albumin, bilirubin, edema, and ascites; Kernel DynSHAP concentrated DDH attribution at the last timestamp, while Temporal DynSHAP attributed more to historical data.The albumin and prothrombin attributions match risks identified in the Mayo model.Source: §4.2 · p. 6, Figure 5 · p. 7

5 Conclusion

DynSHAP extends SHAP to dynamic survival analysis, and Temporal DynSHAP recovers clinically meaningful historical attribution on real clinical data, with somewhat reduced stability under input perturbation.

5 Conclusion

  • Temporal DynSHAP recovers clinically meaningful historical attribution where marginal estimators collapse explanations onto the most recent visit, with somewhat reduced stability under input perturbation.The conclusion also reports that Temporal SHAP recovers temporally dependent features substantially better than marginal estimators.Source: §5 · p. 7

A On DynSHAP Properties

  • Local accuracy requires the predicted survival curve to equal the baseline curve plus the time–feature pairs’ contribution curves at each predicted timestamp.The conclusion identifies linear-Gaussian temporal conditionals as a boundary for future work, calling for methods that better capture nonlinear or longer-range dependencies.Source: §5 · p. 7, A On DynSHAP Properties · p. 10
  • A feature never recorded for a patient in a time bin must receive zero attribution for that time–feature pair.Source: A On DynSHAP Properties · p. 10
  • If a pair’s marginal contribution increases across models for every coalition, its attribution must not decrease at any predicted timestamp.Source: A On DynSHAP Properties · p. 10

A.1 Violations by landmarking

  • Landmarking violates local accuracy, as shown by its local-accuracy residuals.Local accuracy is desirable because it guarantees no missing information and fair credit distribution when combined with other SHAP properties.Source: §A.1 · p. 10

B Dataset Description

The experiments use two clinical datasets, a linear model with known attributions for testing, and two deep-learning survival architectures as black-box candidates.

B Dataset Description

  • The explainer is evaluated in two medical domains: longitudinal PBC data and a simulated MS dataset.The PBC trial dataset contains 312 patients and 18 features; the MS dataset contains 500 patients and 98 preprocessed features, filtered to those recorded in at least 10 MS cases.Source: B Dataset Description · p. 10

C.0.1 Baseline Models

  • An additive linear model with known feature attributions serves as a simple correctness test for the implemented algorithms.Source: §C.0.1 · p. 11

C.0.2 Dynamic-DeepHit

  • Dynamic-DeepHit combines an RNN and attention for temporal dependencies, then uses cause-specific subnetworks and a softmax output.Its training objective combines log-likelihood, ranking, and prediction losses to handle longitudinal measurements and right-censoring.Source: §C.0.2 · pp. 11–12

C.0.3 DySurv

  • DySurv combines an LSTM encoder, a probabilistic encoder, and an MLP that predicts discrete-time cumulative-incidence risks.Training combines a survival loss for right-censored observations with a VAE loss that includes reconstruction and latent-space regularization.Source: §C.0.3 · pp. 12–13

C.1 Training Configuration

The authors searched common hyperparameters for Dynamic-DeepHit and DySurv, aiming for a time-dependent concordance index of at least 0.7.

C.1 Training Configuration

  • The hyperparameter search targeted a time-dependent concordance index of at least 0.7 for both black-box models.Source: §C.1 · p. 13
  • Tables 3 and 4 list the hyperparameters used to train Dynamic-DeepHit and DySurv, respectively, on each dataset.Source: Table 3 · p. 13, Table 4 · p. 13

C.2 Training Results

The training-results section points to aggregated model metrics, while the following synthetic-data section motivates ground-truth benchmarking for explanations.

C.2 Training Results

  • Table 5 summarizes Dynamic-DeepHit and DySurv performance across datasets using time-dependent concordance index and integrated Brier score.The table reports mean ± one standard deviation.Source: §C.2 · p. 13, Table 5 · p. 13

D Synthetic Data and Ground Truth Definition

D.0.1 Synthetic Data Generation

The synthetic benchmark uses irregular longitudinal data with four covariates designed to test temporal dependence, temporal attribution, static risk, and spurious attribution. Ground-truth SHAP values are approximated using conditional sampling from the data-generating distributions.

D.0.1 Synthetic Data Generation

  • The benchmark uses 2,000 patients, irregular visits, four designed covariates, Weibull proportional hazards, and 30% administrative right-censoring.Visit gaps are drawn from Uniform(0.5, 2.0).Source: §D.0.1 · p. 14
  • The autocorrelated biomarker tests temporal dependence: marginal estimators sample independently across time, while Temporal SHAP aims to preserve temporal structure.The continuous-time AR(1) feature uses α = 0.85, creating strong dependence between consecutive observations.Source: §D.0.1 · p. 14
  • A treatment indicator switches on at a patient-specific time and tests whether attribution is localized after activation; a static binary risk factor should have constant attribution across time bins.Treatment has β1 = −2.5, indicating decreased risk.Source: §D.0.1 · p. 14

D.0.2 Ground Truth SHAP

  • Ground-truth SHAP values use the exact conditional value function, sampling omitted time–feature pairs from the true data-generating distributions.This mirrors Temporal SHAP's conditional sampling but uses the true distributions instead of learned approximations.Source: §D.0.2 · p. 14

E Exploring Temporal Dependence in Data

Tests on real-world medical data indicate temporal dependence among features, motivating a temporal estimator. Additional checks find negligible error for marginal estimators on a linear additive model, while Temporal DynSHAP has a larger RMSE in that setting.

E Exploring Temporal Dependence in Data

  • The analysis pools consecutive visits and uses F-tests to test whether past feature values improve prediction of current values, rejecting the null at p < 0.05.The tests are run for each model feature.Source: E Exploring Temporal Dependence in Data · p. 15
  • Real-world features are not fully independent across time: past values predict future values, although Granger causality does not establish true causality.The result motivates estimators that account for temporal dependencies.Source: E Exploring Temporal Dependence in Data · p. 15

F.1 DynSHAP Correctness

F.2 Robustness to Noise

Temporal SHAP is less stable than KernelSHAP on synthetic and PBC data, while both are comparable on MS data. Its sampling reduces runtime, and an MS case study illustrates model-history differences and both clinically valid and spurious attributions.

F.2 Robustness to Noise

  • Temporal SHAP has roughly 3× higher median log RIS than KernelSHAP on synthetic and PBC data; on MS, both show comparable log RIS (3.49).The paper notes that results for both estimators fall within a range considered stable in the literature.Source: Figure 10 · p. 16, §F.2 · p. 16

F.3 Computational efficiency

  • Temporal SHAP's sampling reduces runtime; Figures 11 and 12 assess RMSE and runtime across speedup settings and background sizes.The convergence analysis uses DDH trained on synthetic data and reports means and standard deviations across five seeds.Source: §F.3 · p. 16, Figure 11 · p. 17, Figure 12 · p. 17

F.4 MS Case Study

  • For one MS-positive patient, DySurv uses more history than DDH; R03 medications are clinically plausible attributions, while ICD Z03 is a spurious risk association.Z03 is associated with reduced survival but is described as indicating greater medical help-seeking, not causing MS.Source: §F.4 · p. 16, Figure 13 · p. 18
Loading 2609.13042v1…