Introduction
In time series forecasting, the industry is transitioning from transparent statistical models like SARIMA to high-performance "black-box" machine learning and deep learning architectures such as N-BEATS or XGBoost. While these modern models offer superior accuracy, their internal logic is often opaque. For a retail manager, understanding why a sales spike is predicted is as crucial as the prediction itself. TsSHAP addresses this by providing a model-agnostic framework that translates complex model outputs into human-readable, feature-based explanations.
Methodology: The Surrogate Approach
The core innovation of TsSHAP is its use of a surrogate modeling framework. Rather than attempting to interpret the internal weights of a complex neural network, TsSHAP treats the forecaster as a black box and trains a "mimic" model to replicate its behavior using interpretable features.
Data Generation via Backtesting
To train the surrogate, the authors employ an "expanding window" strategy on historical data. By running the black-box forecaster across these historical windows, they generate a comprehensive dataset of model predictions.
Feature Engineering and Interpretation
Raw time series data is transformed into several feature families that align with human reasoning:
- Lags & Seasonal Lags: Historical values from relevant prior periods.
- Rolling/Expanding Windows: Statistical aggregations like moving averages or extrema.
- Temporal Features: Calendar-based indicators (holidays, day of week).
- Trend Components: Polynomial representations of underlying growth or decay.
An XGBoost regressor serves as the surrogate, mapping these features to the black-box model's outputs. The use of a tree-based surrogate allows for the application of the efficient TreeSHAP algorithm to derive feature importance scores.
Multi-Scope Explanations
TsSHAP provides insights across three distinct scales:
- Local: Explains a specific point-in-time forecast.
- Semi-Local: Explains the average forecast over a defined interval (e.g., a monthly planning horizon).
- Global: Captures the model's general logic across the entire dataset.
Experimental Validation
The framework was validated across five diverse datasets, ranging from proprietary retail sales (jeans-sales) to public economic indicators (US unemployment) and social media trends (Peyton Manning Wikipedia views).
Key Results
A critical finding is that the surrogate model does not need to be a perfect forecaster of reality; it must be a perfect mimic of the black box. The authors measured this "mimicry" using Mean Absolute Percentage Error (MAPE).
As shown in the results, surrogate accuracy is exceptionally high for simpler models (MAPE often < 0.05) and remains within reliable bounds even for complex architectures like Prophet and XGBoost. Furthermore, "faithfulness" tests—where input data is perturbed to see if SHAP values respond predictably—confirmed that the explanations accurately reflect the underlying model's logic.
Conclusion and Future Work
TsSHAP successfully bridges the gap between high-performance forecasting and interpretability. While currently focused on univariate series, it demonstrates that feature-based mimicry is a robust path toward trustworthy AI in time series. Future research will focus on extending the framework to multivariate models and explaining prediction intervals to account for forecast uncertainty.
Summary updated