# Research on Predictive Analysis Method of Building Energy Consumption Based on TCN-BiGru-Attention
## 3 Research Methods
### BiGRU  
The BiGRU (Bidirectional Gated Recurrent Unit) model enhances the GRU (Gated Recurrent Unit) framework, a specialized variant of the Recurrent Neural Network (RNN). GRUs optimize the processing of sequential data through sophisticated mechanisms such as update and reset gates. These features not only improve efficiency over conventional RNNs in handling time series data but also diminish computational demands. The schematic representation of a GRU's architecture elucidates its operational dynamics (Figure 3). \begin{table}
\begin{tabular}{c c c c c c} \hline \hline  & **MAE** & **MAPE** & **MSE** & **RMSE** & \(\mathbf{R^{2}}\) \\ \hline LSTM & 7.495 & 0.931462 & 120.2992 & 10.9681 & 0.95942 \\ TCN & 9.6447 & 1.5514 & 169.2832 & 13.0109 & 0.95231 \\ BP & 6.9842 & 0.59149 & 105.7992 & 10.2859 & 0.969667 \\ TCN-BiGRU-Attention & 9.4696 & 0.51626 & 159.17 & 12.616 & 0.96103 \\ Optimized TCN-BiGRU-Attention & 7.8705 & 0.35595 & 114.97 & 10.722 & 0.97185 \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Table of loss functions using different models. Figure 2: The framework of TCN. 1. Reset gate \[r_{t}=\sigma(W_{r}\cdot[h_{t-1},x_{t}]+b_{r}),\] (1)  
Within the context of Equation (1), \(r_{t}\) represents the activation signal of the reset gate at a given instant. The symbol \(\sigma\) embodies the sigmoid function utilized for activation purposes. The matrix \(W_{r}\) encapsulates the weights specific to the reset gate. The term \(h_{t-1}\) signifies the hidden state prevailing at the preceding temporal juncture. The variable \(x_{t}\) corresponds to the input vector at the current temporal instance, and \(b_{r}\) is indicative of the bias term associated with the reset gate. 2. Update gate \[z_{t}=\sigma(W_{z}\cdot[h_{t-1},x_{t}]+b_{z}),\] (2)  
Within the context of Equation (2), \(z_{t}\) denotes the activation signal of the updating mechanism at time. The matrix \(W_{z}\) represents the weight parameters associated with the update gate, and \(b_{z}\) signifies the bias component inherent to the update gate. 3. Candidate hidden gate  
Candidate hidden states are temporary hidden states that contain information that may be added to the true hidden state, which is calculated by the following formula:  
\[\tilde{h_{t}}=\tanh(W\cdot[r_{t}*h_{t-1},x_{t}]+b), \tag{3}\]  
In Equation (3), \(h_{t}\) signifies the prospective hidden state at the instant \(t\). The matrix \(W\) encapsulates the weights pertaining to the candidate hidden state, while \(B\) symbolizes the bias element. The asterisk (*) is utilized to denote the Hadamard product of elements. 4. Final hidden gate  
The final hidden state is the combination of the previous hidden state controlled by the update gate and the current candidate hidden state, which is calculated as follows:  
\[h_{t}=z_{t}*h_{t-1}+(1-z_{t})*h_{t}, \tag{4}\]  
In Equation (4), \(h_{t}\) is the final hidden state at the current moment. BiGRU is a recurrent neural network that improves GRU and is capable of capturing before and after information in time series data. It processes the data in two directions: one processing past-to-present information and the other processing present-to-future information. The traditional GRU structure typically propagates in a unidirectional manner along the sequence, capturing only historical information from the current time point and earlier,  
Figure 3: The framework of GRU. thus neglecting future information. In contrast, the BiGRU structure consists of both a forward GRU and a backward GRU, allowing it to capture both past and future information [23]. Its model structure is shown in Figure 4. It can be seen that the BiGRU hidden state at time step t, denoted as \(h_{t}\), can be divided into two parts: the forward hidden state \(\overrightarrow{h_{t}}\) and the backward hidden state \(\overleftarrow{h_{t}}\). The forward hidden state \(\overrightarrow{h_{t}}\) is determined by the current input \(x_{t}\) and the forward hidden state \(\overrightarrow{h_{t-1}}\) at time \(t-1\).