Time-series forecasting is essential for planning and decision-making across domains, and model explainability is critical for fostering user trust and satisfying transparency requirements. We introduce SHAPformer, an accurate, fast and explainable time-series forecasting model based on the Transformer architecture and Shapley Additive Explanations (SHAP). SHAPformer leverages attention manipulation to make predictions using feature subsets, thereby eliminating the need for sampling from background data required by established SHAP algorithms. As a result, it produces exact explanations in less than one second, achieving speedups of 50–1000 × compared to PermutationSHAP. On synthetic data with known ground-truth explanations, SHAPformer generates explanations that are true to the data. When applied to electrical load data and electricity price data, it achieves competitive predictive performance while providing meaningful local and global insights, including the identification of the past target as the key predictor and the detection of distinct load forecasting behavior during the Christmas period.
As our society moves toward a decarbonized energy system, we need to improve our ability to model, predict, and understand power system behavior and dynamics. The balance between generation and demand on short time scales is reflected by the power grid frequency, making it central to the control of power grids. Hence, an accurate understanding and forecasting of power grid frequency could ease the planning of control actions and thus improve system stability and help save costs. Whether deep learning approaches can provide forecasts of the highly resolved and noisy time series, as they are present in the case of power grid frequency, remains an open question. In this paper, we find that the Temporal Fusion Transformer (TFT) is able to outperform baseline models, while a comparably simple multilayer perceptron is not. By reducing the time resolution of the frequency time series, we investigate and quantify the trade-off between the energy consumption and prediction performance of the TFT. Furthermore, the inclusion of additional exogenous variables (e.g. calendar features, load, or generation) further improves the performance of the TFT. Utilizing the TFT’s inherent interpretability, we identify the forecasted load ramp, the current hour, and the current month as the most relevant features.
A stable supply of electrical energy is essential for the functioning of our society. Therefore, energy and balancing markets of power grids are strictly regulated. With changes in technology, the economy and society, these regulations are also constantly adapted. However, whether these regulatory changes lead to the intended results is not easy to assess. Could eXplainable Artificial Intelligence (XAI) models distinguish regulatory settings and support the understanding of the effects of these changes? In this article, we explore two examples of regulatory changes: The splitting of the German-Austrian bidding zone and changes in the pricing schemes of the German balancing energy market. We find that boosted tree models and feedforward neural networks before and after a regulatory change differ in their respective parametrizations. Using Shapley additive explanations, we reveal model differences, e.g., in terms of feature importance, and identify key features of these distinct models. With this study, we demonstrate how XAI can be applied to investigate system changes in power systems.
Time-series forecasts are essential for planning and decision-making in many domains. Explainability is key to building user trust and meeting transparency requirements. Shapley Additive Explanations (SHAP) is a popular explainable AI framework, but it lacks efficient implementations for time series and often assumes feature independence when sampling counterfactuals. We introduce SHAPformer, an accurate, fast and sampling-free explainable time-series forecasting model based on the Transformer architecture. It leverages attention manipulation to make predictions based on feature subsets. SHAPformer generates explanations in under one second, several orders of magnitude faster than the SHAP Permutation Explainer. On synthetic data with ground truth explanations, SHAPformer provides explanations that are true to the data. Applied to real-world electrical load data, it achieves competitive predictive performance and delivers meaningful local and global insights, such as identifying the past load as the key predictor and revealing a distinct model behavior during the Christmas period.