# Deep-Learning-Powered GRU Model for Flight Ticket Fare Forecasting
## 3 Methodology
### GRU Model  
The gated recurrent unit (GRU) is another type of recurrent neural network that can handle sequential regression problems [45; 46]. GRU is able to memorize and retain important information from past observations in the sequence and is conceptually similar to LSTM [19; 47]. GRU is faster to train and less prone to overfitting, especially when  
Figure 4: Internal structure of an LSTM unit. working with large datasets or limited computational resources. This advantage is particularly relevant for airfare prediction, which often involves handling massive datasets with complex patterns. Another advantage of GRU is its efficiency in capturing long-term dependencies and relationships within time series data [48]. In airfare prediction, this is crucial for capturing factors such as seasonal trends, holidays, and economic fluctuations, which can significantly impact prices over time. GRUs have been shown to effectively capture such relationships, resulting in accurate airfare predictions. In addition, GRUs are less sensitive to the gradient vanishing problem, which can occur in traditional RNNs when learning long-term dependencies [49]. This makes GRUs more robust and better suited for tasks involving lengthy sequences, such as airfare prediction. Moreover, GRUs can be combined easily with other neural network architectures or feature engineering techniques to improve prediction accuracy. All these make GRUs highly adaptable and suitable for tackling complex prediction tasks [3; 31]. Figure 5 displays the internal network structure of a GRU unit. In Figure 5, \(r_{t}\) represents the reset gate, \(z_{t}\) represents the update gate, and \(x_{t}\) denotes the input state, while \(h_{t-1}\) and \(h_{t}\) represent the previous and current hidden states, respectively. The symbols \(W\), \(U\), and \(b\) are the learnable weights and biases of the network. The states of a GRU unit are updated according to the formula below:  
\[z_{t}=\sigma(W_{z}x_{t}+U_{z}h_{t-1}+b_{z}) \tag{8}\]  
\[r_{t}=\sigma(W_{r}x_{t}+U_{r}h_{t-1}+b_{r}) \tag{9}\]  
\[u_{t}=tanh(W_{h}x_{t}+U_{h}(r_{t}\odot h_{t-1})+b_{h}) \tag{10}\]  
\[h_{t}=z_{t}\odot h_{t-1}+(1-z_{t})\odot u_{t} \tag{11}\]  
Equation (8) computes the update gate \(z_{t}\), which determines how much of the previous hidden state \(h_{t-1}\) should be preserved, and how much should be replaced by the new information in \(u_{t}\). The sigmoid function, \(\sigma\), squeezes the input into the range [0, 1]; thus, \(z_{t}\) is a value between 0 and 1. Equation (9) computes the reset gate \(r_{t}\), which determines how much of the previous hidden state \(h_{t-1}\) should be forgotten, and how much should be used to compute \(u_{t}\). Like \(z_{t}\), \(r_{t}\) is also a value between 0 and 1. Equation (10) computes the candidate hidden state \(u_{t}\), which is a new value that is mixed with the previous hidden state \(h_{t-1}\) based on the update gate \(z_{t}\). The hyperbolic tangent function, \(tanh\), compresses the input into the range [\(-\)1, 1]. Finally, Equation (11) computes the new hidden state \(h_{t}\) as a linear combination of the previous hidden state, \(h_{t-1}\), and the candidate hidden state, \(u_{t}\), weighted by the update gate, \(z_{t}\). The symbol \(\odot\) represents element-wise multiplication, and  
Figure 5: Internal structure of a GRU unit. \(1-z_{t}\) represents the complement of \(z_{t}\). This ensures that the new hidden state combines only the relevant information from \(u_{t}\) and \(h_{t-1}\). The architecture of the GRU unit, with its gating mechanisms, allows for better control over the flow of information through the network and has been shown to be excellent in a diverse range of tasks. The GRU network structure is presented in Figure 6. The implementation of the GRU model is shown in Algorithm 1, which is based on the Pytorch framework.