Source-linked AI summary
TempShap: When and How Much a Feature Matters in Time-Series Forecasting
Chi Zhao, Anastasiia Chelnokova, Jing Liu, Elena Parilina
TL;DR
Feature-level Shapley explainers collapse input-lag and forecast-horizon information, leaving two central questions about feature influence unanswered. TempShap assigns loss-based Shapley values to input cells and derives temporal and horizon profiles; its signed rankings improve held-out deletion faithfulness under mean masking. Its explanations are retrospective, and the redundancy mechanism is causally demonstrated only on a synthetic counterexample.
Problem
Most Shapley explainers treat each feature as one player, collapsing input-lag and forecast-output axes into a scalar rather than showing when a feature acts or how its influence changes across the horizon.
Source: §1 · p. 1Method
TempShap uses a retrospective loss-based Shapley game with individual input cells as players and derives temporal-localization and horizon-impact profiles from its attribution tensor.
Source: §1 · p. 1, §3.1 · p. 3, §3.2 · p. 3Results
TempShap’s signed Shapley rankings improve held-out cell-deletion faithfulness under mean masking, with the conclusion reporting gains across estimators, forecasting benchmarks, and model families.
Source: §1 · p. 2, §6 · p. 10Takeaways & Limitations
The resulting fine-grained attribution is presented as practical and operationally useful, supporting applications such as pruning and masking.
Source: §6 · p. 10TempShap explains error after the fact rather than online predictions, and the redundancy mechanism is shown causally only on a synthetic counterexample.
Source: §6 · p. 10
Abstract
from arXiv · showhide
Attribution for a time-series forecaster should answer two questions that a feature-level scalar cannot: when in the input window a feature acts, and how much its influence changes across the forecast horizon. Most existing Shapley explainers treat each feature as one player and therefore collapse both axes. We propose TempShap, a retrospective, loss-based Shapley framework whose players are the individual input cells $(t,i)$. Its attribution tensor yields temporal-localization and horizon-impact profiles. We validate these against planted temporal structures, a tractable exact cell game, and a closed-form attribution oracle for a real linear forecaster. Permutation sharing estimates the cell-level game at localized perturbation cost. Under redundant inputs, one-at-a-time scores under-credit substitutable information, whereas the signed Shapley decomposition preserves total value and yields more reliable held-out deletion rankings under mean masking. A planted counterexample isolates the redundancy mechanism. Experiments show a deletion-ranking advantage across Shapley estimators, forecasting benchmarks, and model families. TempShap therefore makes fine-grained Shapley attribution both practical and operationally useful.
1 INTRODUCTION
Feature-level Shapley scores collapse input-lag and forecast-output axes, leaving practitioners without answers about when a feature matters and how its influence changes across the horizon. TempShap assigns Shapley values to input cells and reports validation and deletion-ranking results for this finer-grained view.
- Most existing Shapley explainers use one player per feature, collapsing input-lag and forecast-output information into a scalar.Source: §1 · p. 1
- TempShap’s cell-level loss-based attribution tensor yields temporal-localization, horizon-impact, and rank-settling profiles.Source: §1 · p. 1
- Planted signals, exact-cell and linear-model oracles, and baseline-robust localization validate the framework; recency ordering is not consistent across architectures.Source: §1 · p. 1
- Under redundancy, signed Shapley rankings improve held-out cell-deletion faithfulness across estimators under mean masking.Source: §1 · p. 2
- Permutation sharing provides an unbiased, axiomatic cell attribution estimator at localized perturbation cost.Source: §1 · p. 2
2 RELATED WORK
Prior work spans tabular Shapley methods, time-series variants at several temporal resolutions, and non-Shapley attribution and faithfulness evaluation. TempShap’s stated distinction is a loss-based tensor retaining input-cell and output-cell axes.
- Shapley sampling and SHAP methods develop feature attribution, while SAGE (Covert et al., 2020) provides a loss-based global measure; TempShap retains sample, horizon, and target axes.Source: §2 · p. 2
- Time-series explainers use timestep, window, segment, or localized perturbations, whereas TempShap supplies a uniform loss-based tensor for input-cell players and output cells.Source: §2 · p. 2
- LIME (Ribeiro et al., 2016), Integrated Gradients (Sundararajan et al., 2017), and DeepLIFT (Shrikumar et al., 2017) are non-Shapley alternatives; faithfulness work includes deletion scores and sanity checks.Source: §2 · p. 2
3 THE TEMPSHAP FRAMEWORK
TempShap treats individual input cells as players in a loss-based Shapley game and summarizes the resulting attribution tensor with temporal, horizon, and ranking profiles. Its cell-pShapley estimator shares permutations across cells, with stated guarantees and an affine-forecaster exactness result.
3.1 SETTING AND CELL-LEVEL MASKING
- The framework replaces masked cells with per-feature training means and masks each input cell separately, preserving the input-time axis.Source: §3.1 · p. 3
3.2 PER-CELL CHARACTERISTIC FUNCTION AND SHAPLEY VALUES
- Each output cell uses negative squared error as its payoff; positive attribution means retaining an input cell reduces error relative to the all-masked reference.Source: §3.2 · p. 3
3.3 ESTIMATORS AND COST
- Cell-pShapley restores cells in random order and shares each permutation’s model evaluations across cells; its cost is linear in the sampling budget.Source: §3.3 · pp. 3–4
3.4 PROPERTIES OF CELL-PSHAPLEY
- Cell-pShapley is unbiased, and sampled forward and reverse paths preserve efficiency; reversal pairing can reduce variance when the covariance is negative.Source: §3.4 · pp. 4–5
- For DLinear, one antithetic permutation pair agrees with the high-budget reference up to numerical precision; nonlinear-model pairing gains vary and are small for the Exchange-Rate Transformer.Source: §3.4 · p. 5
3.5 TEMPORAL PROFILES AND RANK SETTLING
- Temporal-localization profiles summarize absolute attribution by input lag, horizon-impact profiles by forecast step, and rank settling tracks when cumulative feature rankings stabilize.Source: §3.5 · p. 6
4 EXPERIMENTAL PROTOCOL
The protocol evaluates attribution methods on three forecasting datasets and three architecture families. It also specifies the references and held-out cell-deletion procedure used to compare rankings.
4 EXPERIMENTAL PROTOCOL
- Experiments use Jena climate, ETTh1, and LSTNet Exchange-Rate with T = H = 24, and compare LSTM, Transformer encoder, and DLinear forecasters.Single-target forecasting is primary; the models share a 40-epoch training budget with early-stopping patience 6.Source: §4 · p. 6
- cell-pShapley is the deployed default, with cell-ShapG as a graph baseline and TimeSHAP-c and cell-Exact as references.The references provide an independent agreement check and an oracle for a tractable small case, respectively.Source: §4 · p. 6
- Deletion faithfulness ranks cells by importance, masks them to the mean in 10% grid steps, and scores the resulting performance drops with an adapted weighted-slope score.Rankings use 24 test windows, while scoring uses the following disjoint 24; all methods share the same mean-mask evaluator.Source: §4 · p. 6
- The ranking and evaluation sets contain different window instances, but 1–3% of pairs overlap in underlying timestamps; a timestamp-disjoint control leaves the ranking comparison unchanged.Windows are sampled without replacement from the same shuffled test split.Source: §4 · p. 6
5 RESULTS
Cell-level attribution recovers planted temporal structure and exposes how feature influence changes across forecast horizons. Under mean masking, signed Shapley rankings improve held-out deletion results, while real-data profiles reveal dataset- and model-specific patterns.
5.1 GROUND-TRUTH VALIDATION
- Across planted constructions, localization profiles recover active lags, horizon-impact profiles track planted decay, and rank settling remains distinct from magnitude decay.For C1, the three cell estimators recover both planted lag bands to within one lag and rank both signal features top-2.Source: Figure 2 · p. 7, §5.1 · p. 7
- In the exact cell game, cell-pShapley matches the planted centroid of 2.5, while on real DLinear forecasters it recovers the prediction-based oracle values.For DLinear, cell-pShapley has signed Pearson 1.00, per-cell Kendall-τ 1.00, and 0 lag centroid error; this prediction-based oracle is distinct from the loss-based headline game.Source: §5.1 · p. 7
5.2 COMPETITOR COMPARISON
- Feature- and chunk-level players cannot separate planted lags; cell-level methods recover both, and cell-pShapley localizes at least as sharply as PAX-TS at the compared budget.cell-pShapley is the only cell-level method described as Shapley-axiomatic and running at perturbation cost; cell-ShapG requires 6.4× more evaluations.Source: Table 2 · p. 8, §5.2 · p. 8
5.3 REDUNDANCY AND DELETION FAITHFULNESS
- Under mean masking, signed cell-pShapley beats cell-LOO on every dataset-model case and PAX-TS on 8 of 9; the advantage does not persist under conditional imputation.Across 27 paired runs, exact sign tests give p < 10^-6 versus cell-LOO and p < 10^-4 versus PAX-TS; unsigned |ϕ| falls back to PAX-TS (14/27).Source: §5.3 · p. 8, Table 4 · p. 9
5.4 REAL DATA
- At the reported sampling budget, profiles vary little across independent permutation draws in eight of nine dataset-model cases, with the Exchange-Rate Transformer as the exception.Baseline, payoff, and budget sensitivity controls are also reported.Source: §5.4 · p. 9
- Real-data profiles show no consistent recency ordering across architectures; most localization profiles are near uniform, while rank-settling behavior varies across cases.A single feature dominates across families on two datasets: OT on ETTh1 and AUS on Exchange-Rate.Source: §5.4 · p. 9, Table 5 · p. 10
6 CONCLUSION
TempShap resolves input lag and forecast horizon through a cell-level loss game, with signed Shapley rankings improving held-out deletion faithfulness under mean masking. Its evidence is bounded by retrospective explanations, empirical deletion results, and one model per family.
- TempShap uses a cell-level loss game to resolve input lag and forecast horizon, and its signed Shapley rankings improve held-out deletion faithfulness under mean masking.The gains are reproduced across estimators and support applications such as pruning and masking.Source: §6 · p. 10
- The framework explains error retrospectively, its redundancy mechanism is shown causally only on a synthetic counterexample, and its deletion-ranking advantage is empirical rather than generally optimal.The evaluation uses one model per family rather than multiple tuned instances.Source: §6 · p. 10
- Open directions include rankings suited to conditional deletion, multitarget extensions that account for each target’s own-history contribution, and scalability tests at larger T·M and on more architectures.Examples of architectures named are PatchTST and TFT.Source: §6 · p. 10
A.1 SETUP AND SYNTHETIC CONSTRUCTIONS
Synthetic constructions plant known temporal signals in correlated feature blocks, enabling checks of temporal recovery and rank-settling behavior. The setup also reports the hardware used for timing measurements.
- Timing measurements use one NVIDIA RTX 4090, a 32-thread Intel Core i9-13900F, and 32 GB of RAM.Source: §A.1 · p. 13
- Synthetic C1 plants features 0 and 4 in separate four-lag bands, while C2 and C3 plant signals over lags 8–11 with horizon-dependent scaling.The constructions use T = H = 24, M = 8, correlated blocks, and one 32-unit LSTM.Source: §A.1 · p. 13
- Cell estimators peak at both planted lags 9 and 17, while PAX-TS has a more multi-peaked feat4 profile and GS-SHAP is flat because its groups cannot separate features.Source: Figure 4 · p. 13
- Synthetic C3’s cumulative importance settles at h = 1 despite decaying magnitudes, whereas the settling horizon differs by architecture on Jena.The settling order is what τh measures.Source: Figure 5 · p. 13
A.2 REAL-DATA PROFILES AND LINEAR ORACLE
Real-data profiles show that feature influence can fluctuate across the forecast horizon, while top-feature rankings stabilize before individual magnitudes do. The section also presents a comparison with a closed-form DLinear oracle.
- Table 6 reports agreement with the closed-form DLinear oracle using signed Pearson, per-cell τ and Spearman, and maximum absolute centroid difference in lags.Source: Table 6 · p. 13
- The top-4 feature set settles within a few dozen averaged windows, well before individual cell-pShapley magnitudes stop drifting.The profile uses N = 256 real-data windows.Source: Figure 6 · p. 14
- Across real-data profiles, horizon impact D(h) is nonmonotone, so a top feature’s influence fluctuates rather than simply decaying across the horizon.The figure also plots temporal influence g(t) for cell-pShapley and cell-ShapG, with centroids marked for cell-pShapley profiles.Source: Figure 7 · p. 14
A.3 FEATURE-LEVEL EXACT CONTROL
The exact whole-feature control shows that changing the player set alters how redundant information is credited, even when the grand total is efficiency-respecting.
- The whole-feature game gives a redundant pair 347 ± 124% of its joint value and splits credit unevenly between copies, at 1.6±1.3 across seeds.Source: §A.3 · p. 15
- Whole-feature coalitions differ from the cell game, and removing an entire feature history can push highly correlated copies far off the data manifold.Source: §A.3 · p. 15
- Efficiency fixes only the grand total, not its division among players; the value captured by a player group depends on the game’s player set.Source: §A.3 · p. 15
A.4 SENSITIVITY CONTROLS
Sensitivity controls find that the temporal profiles are generally stable across imputation, payoff, and sampling choices, with slower convergence or uncertainty in some cases. Under Gaussian conditional-mean deletion, cell-pShapley beats cell-LOO on 11/27 runs, while |ϕ| has the highest median S.
A.4 SENSITIVITY CONTROLS
- Changing the payoff moves the when-centroid by ≤0.3 lags for prediction-based v(S) and by ≤1.2 lags for a global R2 game; the first-ranked feature changes in only one cell.The profiles do not hinge on the choice of v.Source: Table 7 · p. 15, §A.4 · p. 15
- Replacing mean masking with a Monte-Carlo marginal expectation moves the when-centroid by at most 1.4 lags (median 0.3), while the observational game agrees within ∼1 lag on 8/9 cells.The exception is Exchange-Rate LSTM at ∼3 lags, the least-predictable dataset.Source: §A.4 · p. 15
- Error against the independently sampled finite-budget reference need not follow a pure m^-1/2 rate, particularly as m approaches the reference budget.The observed error decrease is consistent with Monte-Carlo convergence, but the reference itself uses finitely many pairs.Source: §A.4 · pp. 15–16
- At mπ=32, normalised gi(t) has mean total-variation distance below 0.021 in eight cases, while normalised Di(h) distance is at most 0.010 in all nine.The Exchange-Rate Transformer’s gi(t) distance is 0.164, leaving its fine temporal structure uncertain; the three DLinear cases are exact at every budget.Source: §A.4 · p. 15, Figure 8 · p. 16
- At mπ=1, the when-centroid is already within a quarter of a lag on 8/9 cases, although cell values continue improving through mπ=64.The Exchange-Rate Transformer is the exception and converges slowly on both measures.Source: §A.4 · p. 15, Table 8 · p. 16
A.5 ON-MONIFOLD DELETION
- Under Gaussian conditional-mean deletion, cell-pShapley beats PAX-TS on 3/27 runs and cell-LOO on 11/27; |ϕ| has the highest median S.ETTh1 reconstruction had R2 < 0 on 22/72 tested deletion sets, versus 0/72 for Jena and Exchange-Rate; excluding ETTh1, cell-pShapley beats cell-LOO on 5/18 runs and |ϕ| beats PAX-TS on 16/18.Source: §A.5 · p. 16, Table 9 · p. 17