# Explanatory Optimization of the Prediction Model for Building Energy Consumption

Authors: Huiyu Li; Hailong Dong
Journal: Computational Intelligence and Neuroscience
 (2022)

---

## Abstract

Traditional prediction models, which are based on artificial neural networks (ANNs), consider the various factors affecting building energy consumption comprehensively. However, their explanatory power is not ideal in actual application, resulting in prediction errors of building energy consumption. Thus, this paper pursues the explanatory optimization of the prediction model for building energy consumption. First, the authors displayed the architecture of the prediction model for building energy consumption, which is based on the temporal pattern attention mechanism (TPAM), and explained the principle of predicting building energy consumption. Then, the input of the TPAM was illustrated, and the execution steps of the model were depicted. Based on feature importance and the Shapley additive explanations (SHAP) method, the explanatory power of the proposed prediction model was analyzed, from the perspective of the time series features of building energy consumption prediction. The proposed model was proved effective through experiments.


---

## Body

## 1. Introduction

With the rapid development of the economy, global energy consumption has increased year by year. Meanwhile, buildings become larger in scale, and better in grade, taking up a growing portion in global energy consumption. Therefore, it is practically significant to reduce the energy consumption, lower the emissions, and predict the energy consumption of large buildings [1–7]. For models with low data requirements, the trend of the time series for building energy consumption prediction can be obtained through simple statistical analysis of time nodes. Then, it is possible to make the final prediction of building energy consumption [8–17]. Traditional prediction models, which are based on artificial neural networks (ANNs), consider the various factors affecting building energy consumption comprehensively. However, their explanatory power is not ideal in actual application, resulting in prediction errors of building energy consumption. This significantly limits the applicable range of the models. As a result, it is necessary to develop models that can explain building energy consumption [18–21].Nearly, 40% of global carbon emissions come from the building industry, which has a great potential for meeting the climate targets. Aiming to enhance building energy efficiency, the energy performance certificate requires accurate prediction of building energy performance. With the significant improvement of information and communication technology, the data-driven method has been introduced to study building energy performance and proved to boast a high computing efficiency and predictive performance. Nevertheless, most studies focus on predictive performance, without considering the potential of explaining artificial intelligence (AI). To fill up the gap, Wenninger et al. [6] designed the novel QLattice algorithm, which considers both predictive performance and the explanatory power. The algorithm was applied to forecast the annual energy-saving performance on a dataset containing 25,000 plus German residential buildings. Lei and Yin [22] improved the standard backpropagation (BP) neural network with the Levenberg–Marquardt (LM) algorithm and built an LMBP-based prediction model for the lighting energy consumption of high-rise buildings. The traditional prediction models for building energy consumption in shopping malls face limitations in the type and number of input variables. To overcome the limitations, Jing et al. [23] proposed a prediction model for building energy consumption in shopping malls based on the chaotic theory. The first step of the model is to compute the Lyapunov exponent of the energy consumption, which proves the chaotic nature of the energy consumption. As an important process in the sustainable building design, the evaluation of building energy-saving performance has a great impact on global energy reduction and environmental protection. Li et al. [24] developed an efficient way to evaluate building energy consumption. Their strategy integrates building information modeling (BIM), energy consumption simulation, and energy consumption prediction. The accurate prediction of building energy consumption is of great significance to the building energy management system. Nonetheless, building energy consumption is difficult to predict because the relevant data are often nonlinear and unsmooth. Karijadi and Chou [25] combined random forest (RF) and long short-term memory (LSTM) to predict building energy consumption, based on the complete ensemble empirical mode decomposition with adaptive noise (CEEMDAN).Many studies have successfully predicted building energy consumption. Yet, most of them concentrate on improving prediction accuracy, summing up the key factors affecting building energy consumption, and the research trend of building energy prediction. The prediction effect of ensemble models depends on the basic learner and the ensemble strategy. It is impossible to demonstrate whether the model prediction is trustworthy or not. Thus, the prediction results often trigger many controversies. As a result, the building energy prediction models lack explanatory power. The model users in need of forecasting building energy consumption no longer trust the prediction results. In addition, the models are not frequently used in actual scenarios. Therefore, this paper pursues the explanatory optimization of the prediction model for building energy consumption. Section2 displays the architecture of the prediction model for building energy consumption, which is based on the temporal pattern attention mechanism (TPAM), and explains the principle of predicting building energy consumption. Section 3 illustrates the input of the TPAM, and details the execution steps of the model. Section 4 analyzes the explanatory power of the proposed prediction model based on feature importance and the Shapley additive explanations (SHAP) method, from the perspective of the time series features of building energy consumption prediction. Finally, the proposed model was proved effective through experiments.


## 2. Prediction Principle of Building Energy Consumption

In traditional prediction models of building energy consumption, an information loss may occur due to the connection vector between the encoder and the decoder. To solve the problem, this paper introduces the TPAM to the existing prediction framework. The new prediction model can make better predictions of building energy consumption, during the handling of the input time series, which involve multiple variables. Figure1 illustrates the architecture of the TPAM-based prediction model for building energy consumption.Figure 1
TPAM-based prediction model for building energy consumption.Compared with traditional attention mechanism, the TPAM can effectively handle the multivariate input time series for the forecast of building energy consumption. This mechanism can mine more deep-seated information from the multivariate input time series, according to the weights of specific variables, and the acquired local features. It can also identify the lost position and other key information. The TPAM mainly encompasses two parts: a time detection module of convolutional neural network (CNN) and an attention weighting module. The workflow of the TPAM is as follows:In the prediction model, the bidirectional gated recurrent unit (BiGRU) layer mainly computes the n-dimensional hidden statefi of each time step, and then derive the hidden state matrix F = {fe−q, fe-+1, …, fe−1}, where q is the length of the sliding window. For the time series for building energy prediction, the states of each variable at all time steps can be represented by a row vector of the hidden state matrix E. The states of all variables at each time step can be characterized by a column vector in that matrix. Then, a one-dimensional (1D) CNN can be called to extract the variable time pattern:(1)Fi,jD=∑k=1qFi,e−q−1+k×Dj,E−q+k.Formula (1) performs a convolution operation D with l filters and the kernel size of 1 × E over the row vector of F, producing the time pattern matrix FD corresponding to that variable. Let FijD be the calculation result of the i-th row vector and the j-th kernel; FiD be the i-th row of matrix FD; Qx be the trainable weight matrix; fe be the hidden state outputted by the BiGRU layer. Then, the variable time pattern can be evaluated by the following:(2)gFiD,fe=FiDEQxfe.To obtain multiple variables that facilitate the prediction of building energy consumption, the TPAM would determine the attention weights by sigmoid function. The attention weightβi can be calculated by the following:(3)βi=sigmoidgFiD,fe.Finally, the context vector vtue can be obtained as the weighted sum of the vectors in rowFD:6(4)ue=∑i=1nβiFiD.The GA optimization of the BP neural network intends to improve the initial weights and thresholds of the network. However, the traditional GA has difficulty in optimizing the structural parameters of the neural network. The main difficulty lies in the variation of chromosome length with the number of hidden layers. To solve this problem, the GA is improved in this research. In the improved GA, the single-point crossover is adopted as follows:(5)a˜1,je=0.5×1+Φja1je+1+Φja2je,a˜2,je=0.5×1+Φja1je+1+Φja2je,where(6)Φj=2λj1/γ+1,ifλj≤0.5,121−λj1/γ+1,Otherwise,λj∈V0,1withλ>0being  the  dispersion  index.The improved GA adopts polynomial mutation. Suppose the mutation operator isul′=ul+ξ⋅vl−kl,ξ1=ul−kl/vl−kl,andξ2=vl−ul/vl−kl. Let vdenote a random variable in [0, 1]; γn denote the dispersion index; ul denote a parent individual. Then, ξ can be calculated by the following:(7)ξ=2v+1−2v1−ξ1γn+11/γn+1−1,ifv≤0.5,1−21−v+2v−0.51−γ2γn+11/γn+1,ifv>0.5.


## 3. Construction of the Energy Consumption Prediction Model

The TPAM-based energy consumption prediction model consists of three parts: BiGRU encoder, TPAM, and BiGRU decoder. Figure2 illustrates the input of the TPAM. The prediction model is executed in the following steps:Figure 2
Input of TPAM.Step 1.
Letae be the input time series at the current time step; fe −1 be the hidden state at the previous time step; fe be the hidden state at the current time step e. After importing ae, and fe −1 into the encoder, fe can be calculated by the following:(8)fe=BiGRUencoderae,fe−1.Step 2.
Letbe −1 be the previous output series; re −1 be the hidden state of the previous time step; re be the hidden state of the current time step. Based on be −1 and re −1, the decoder can compute re:(9)re=BiGRUdecoderbe−1,re−1.Step 3.
LetQu be the parameter matrix. The context vectors ue and re can be connected to obtain the following:(10)r^e=tanhQuue;re.Step 4.
LetQr be the parameter matrix. Then, be can be solved based on the SoftMax function:(11)be=softmaxQrr^e.
The energy consumption of buildings is affected by various factors. The time series inputted to predict building energy consumption can be divided into the historical energy consumptions at then previous moments, time variables, and weather variables. Here, the objective function of building energy consumption prediction is defined as follows:(12)b^=GA,B,where A=(PE, SF, XO, QR, F, C, Q, N, W), with PE, SF, XO, QR, F, C, Q, N, and W being the various input variables, such as wind velocity, humidity, temperature, and sun intensity. The historical energy consumptions at the n previous moments are denoted by B = (Ke, Ke −1, Ke −2, Ke −3, Ke −4, …, Ke − n), with n being the window length of the historical data. The predicted values for the m future moments are denoted as b∗=be+1∗,be+2∗,be+3∗,…,be+m∗. Figure 3 illustrates the input data of the model.
The Adam algorithm can dynamically adjust the learning rate of each parameter, making the update of parameters steadier. In actual applications, this algorithm outshines most gradient-based optimizes. This paper relies on the Adam algorithm to iteratively update the weight and bias of each node of the prediction model, in order to obtain an adaptive learning rate. Letne and me be the estimation for the first-order moment of gradients, and that for the second-order moment of gradients; ne′ and me′ be the correction for ne and me, respectively; γ be the learning rate. Then, we have as follows:(13)ne=λ∗ne−1+1−λ∗he,me=u∗me−1+1−u∗he2,Δωe=−n^em^e+σ∗γ,where ne′ and me′ can be viewed as unbiased estimates of expectations. The loss function of the model is the easily solvable mean squared error (MSE):(14)MSE=∑i=1mb^i−bio2m,where m is the number of samples; bi and bio are actual value and predicted value, respectively.Figure 3
Input data of the model.


## 4. Analysis on Explanatory Power

Based on feature importance and the SHAP method, the explanatory power of the proposed prediction model was analyzed, from the perspective of the time series features of building energy consumption prediction.To disturb each time series for predicting building energy consumption, noises are added to the eigenvalues of each time series. The model performance is measured by MSE (14). The importance of feature l can be calculated by the following:(15)Δl=MSEli−MSElj.Let MSEi and MSEj denote the MSE of the model before and after noise addition, respectively. The greater the SHAP feature importance, the more important the features of a time series. The SHAP feature importance can be calculated by the following:(16)GYj=1m∑i=1mΨji,where m is the sample size; Ψji is the Shapley value of the j-th feature in the i-th time series sample.The interaction effect between time series features can be measured by the effect of the combinatory features added to a single time series feature. The Shapley interaction index of two time series features can be defined as follows:(17)Ψi,j=∑r⊆a1,...,ao/ai,ajR!o−R−2!2o−1!ξijR.Ifi≠j, we have the following:(18)ξijR=gR∪ai,aj−gR∪ai−gR∪aj+gR.


## 5. Experiments and Result Analysis

To highlight the universality of predicting building energy consumption, two different public datasets were selected from China and a foreign country for our experiments.Out of the various factors affecting building energy consumption, the change of the local climate is a leading factor. This paper summarizes the energy consumption of target buildings at different temperatures. The results in Figure4 show that when the temperature is below 20°C, the mean energy consumption of buildings does not change significantly with the rise of the mean temperature; when the temperature is above 20°C, the mean energy consumption of buildings surges up with the growth of the mean temperature, mainly due to the increase of refrigeration loads.Figure 4
Influence of temperature on building energy consumption.To demonstrate its effectiveness, the proposed prediction model of building energy consumption was compared with recurrent neural network (RNN) (model 1), GRU (model 2), LSTM (model 3), deepQ network (DQN) (model 4), and dueling DQN (model 5). Figure 5 compares the prediction results of the different models. It can be observed that the prediction of our model is closer to the actual value, and more accurate than that of other models. Besides, the prediction effect of our model is better, when the refrigeration load consumes much energy during the working period, as evidenced by the minimum prediction error.Figure 5
Prediction results of different models.Table1 compares the prediction errors of different models. Obviously, the five models differed significantly in the prediction accuracy on the time series for building energy consumption. Our experiment lasted five months. The results show that our model had a 3–6% lower MAPE and 35–50% lower MSE than the other models. The low MAPE and MSE demonstrate the good generalization and robustness of our model.Table 1
Prediction errors of different models.
PeriodMetricDatasetModel 1Model 2Model 3Model 4Model 5Our modelJanuaryMAPE16.24%14.73%12.15%10.58%13.96%6.48%MSE7.196.335.244.353.852.39FebruaryMAPE17.54%15.21%14.62%9.58%9.16%5.37%MSE7.986.085.034.814.592.74MarchMAPE16.61%14.73%12.54%9.38%14.71%6.85%MSE7.496.635.064.714.382.74AprilMAPE17.28%16.11%13.62%11.48%9.62%5.37%MSE6.996.526.094.354.182.63MayMAPE17.84%17.03%16.95%11.41%13.64%6.17%MSE7.845.875.164.954.352.81MeanMAPE15.78%114.57%13.05%11.62%13.84%6.37%MAPE is short for mean absolute percentage error.As a tool for explaining the prediction of building energy consumption, SHAP can explain the quality of the prediction on a single test sample, and the importance of complex time series features. Figure6 compares the metrics of different models. It can be seen that our model predicted building energy consumption better than the other models, as evidenced by its superior fitting effect on the time series for building energy consumption.Figure 6
Metrics of different models. RMSE and MAE are short for root mean square error and mean absolute error.Table2 presents the SHAP values of the features of the 11 variables below the mean prediction output. The SHAP values of variables PE, QR, C, Q, and N were smaller than zero, indicating that these variables negatively affect the prediction output of our model. The SHAP values of the other variables are greater than zero, suggesting that they promote the prediction output of our model. In the meantime, the positive effect of the eigenvalues corresponding to the 11 features was smaller than the negative effect of these eigenvalues. Thus, the output of the time series for building energy consumption is smaller than the mean prediction output.Table 2
SHAP values of the features of the variables below the mean prediction output.
VariableEigen valueSHAP valueVariableEigen valueSHAP valuePE43−5.1273C10−0.4627SF42.81.6259Q75.69−0.3162XO1892.4815N184.53−1.4851QR40.53−2.4183W780.4195F720.7481B150.3268b∗360.1245Figure7 shows the importance of the SHAP features of the 11 variables. It can be observed that the high-ranking variables exert a significant impact on the prediction output of building energy consumption. Among them, the SHAP feature corresponding to b∗ was the most important, indicating that b∗ contributes the greatest to the output of the energy consumption prediction model. By contrast, the SHAP feature corresponding to wind velocity PE was the least important, indicating that PE contributes the least to the output.Figure 7
Importance of the SHAP features of the 11 variables.


## 6. Conclusions

This paper optimizes the explanatory power of the prediction model for building energy consumption. Specifically, the authors displayed the architecture of the TPAM-based prediction model for building energy consumption and introduced the principle of predicting building energy consumption. Then, they went on to illustrate the input of the TPAM and explain the execution steps of the model. Based on feature importance and SHAP method, the explanatory power of the proposed prediction model was analyzed, from the perspective of the time series features of building energy consumption prediction. Through experiments, this paper summarizes the energy consumption of target buildings at different temperatures and identifies the main reasons for the influence of temperature on building energy consumption. To demonstrate its effectiveness, our prediction model for building energy consumption was compared with different models. The comparison of prediction errors proves the effectiveness of our model. In addition, the authors displayed the SHAP values of the features of the 11 variables below the mean prediction output and exhibited the importance of the SHAP features of these variables. Finally, the explanatory power of our model was analyzed.Due to the limited data volume, it is difficult to build an energy consumption prediction model for each season. In future, as more data become available, the research of building energy prediction model will be further improved and better prediction effect will be realized.



---

*Source: 9213975-2022-07-31.xml*