TempShap: When and How Much a Feature Matters in Time-Series Forecasting
Organizations: Saint Petersburg State University, 7/9 Universitetskaya nab., Saint Petersburg 199034, Russia
Abstract
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 . 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.
Figures & tables
| Construction | Estimator | when centroid | agreement |
|---|---|---|---|
| C1 ( , ) | planted | — | |
| cell-pShapley | both top-2 | ||
| cell-ShapG | both top-2 | ||
| TimeSHAP-c | both top-2 | ||
| Cell-Exact ( , ) | exact oracle | — | |
| cell-pShapley |
| Method | Shapley | Attribution granularity | Top-2 recovery | Centroid (true: 9) | Centroid (true: 17) | windows | wall-clock |
|---|---|---|---|---|---|---|---|
| feature-ShapG | yes | feature | Yes | — | — | k | s |
| WindowSHAP | yes | time chunk | N/A | — | — | k | s |
| GS-SHAP | yes | group segment | No g | k | s | ||
| PAX-TS | no | cell | Yes | k | s | ||
| cell-ShapG (graph) | yes | cell | Yes | k | s | ||
| cell-pShapley | yes | cell | Yes | k | s |
| corr | cell-pShapley | LOO | PAX-TS mass |
|---|---|---|---|
| Dataset | Family | cell-pShapley | cell-ShapG | TimeSHAP-c | PAX-TS | cell-LOO | |
|---|---|---|---|---|---|---|---|
| Jena | LSTM | ||||||
| Jena | Transformer | ||||||
| Jena | DLinear | ||||||
| ETTh1 | LSTM | ||||||
| ETTh1 | Transformer | ||||||
| ETTh1 | DLinear |
| Dataset | Family | test/naive | top feature | when-centroid | settle |
|---|---|---|---|---|---|
| Jena | LSTM | Tpot (K) | |||
| Jena | Transformer | Tpot (K) | |||
| Jena | DLinear | rho (g/m**3) | |||
| ETTh1 | LSTM | OT | |||
| ETTh1 | Transformer | OT | |||
| ETTh1 | DLinear | OT |
Appendix figures & tables9 assets
Supplementary material from the paper’s appendix.
Appendix
| Dataset | Estimator | signed Pearson | per-cell | Spearman | centroid (lags) |
|---|---|---|---|---|---|
| Jena | cell-pShapley | ||||
| cell-ShapG | |||||
| ETTh1 | cell-pShapley | ||||
| cell-ShapG | |||||
| Exchange-Rate | cell-pShapley | ||||
| cell-ShapG |
| reference (vs mean) | payoff (vs error-reduction) | ||||
|---|---|---|---|---|---|
| Dataset | Family | marginal | conditional | prediction | |
| Jena | LSTM | ||||
| Jena | Transformer | ||||
| Jena | DLinear | ||||
| ETTh1 | LSTM | ||||
| ETTh1 | Transformer | ||||
| relative RMSE of , paired | relative RMSE of , unpaired | when-centroid error (lags) | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Dataset | Family | |||||||||
| Jena | LSTM | |||||||||
| Jena | Transformer | |||||||||
| Jena | DLinear | |||||||||
| ETTh1 | LSTM | |||||||||
| ETTh1 | Transformer | |||||||||
| Evaluator | cell-pShapley | cell-ShapG | TimeSHAP-c | PAX-TS | cell-LOO | ||
|---|---|---|---|---|---|---|---|
| mean mask | median | ||||||
| beats PAX-TS | — | ||||||
| beats cell-LOO | — | ||||||
| conditional | median | ||||||
| beats PAX-TS | — | ||||||
| beats cell-LOO | — |
Explainable Time Series Forecasting
Explainable time series forecasting makes predictions over time interpretable through attributions, structured models, causal reasoning, and counterfactuals.
See all 61 papers