# Short-Term Travel Demand Prediction of Online Ride-Hailing Based on Multi-Factor GRU Model
## 3 Model Analysis  
### Gate Recurrent Unit  
The principle behind the GRU is very similar to LSTM, that is, it uses a gating mechanism to control input, memory, and other information and make predictions at the current time-step [11]. The GRU has two gates, a reset gate and an update gate. Intuitively, the reset gate determines how new input information is combined with previous memories, and the update gate defines the number of previous memories to be saved to the current time-step. Basically, these two gated vectors determine what information can ultimately be used as the output of the gated loop unit. These two gating mechanisms are unique in that they are able to preserve information in long-term sequences without being cleared over time or removed because it is not relevant to the prediction. As shown in Figure 4 above. The update gate helps the model determine how much information from the past should be transferred to the future, or how much information from the previous time-step and the current time-step should be transferred. This is very powerful because the model can decide to copy all the information from the past to reduce the risk of the gradient disappearing. In the time-step \(t\), firstly, we need to calculate the update gate \(z_{t}\) using the following formula:  
\[z_{t}=\sigma(x_{t}W^{z}+h_{t-1}U^{z}) \tag{1}\]  
where \(x_{t}\) is the input vector of the time \(t\) step, the \(t\) component of the input sequence \(X\), which will undergo a linear transformation (multiplied by the weight matrix \(W^{2}\)). \(h_{t-1}\) holds information about the previous time-step \(t-1\), and it also goes through a linear transformation. The update adds these two pieces of information into the _sigmoid_ activation function, thus compressing the activation result to between 0 and 1. The _sigmoid_ function is similar to the \(\tanh\) function and is also non-linear, except that the _sigmoid_ function compels the value into a range of 0 to 1, which helps update or forget information. The _sigmoid_ function formula is as follows:  
\[Sigmoid(x)=\frac{1}{1+e^{-x}} \tag{2}\]  
Figure 3: Comparison of online ride-hailing travel demand combined with rainfall intensity. Essentially, the reset gate determines how much past information needs to be forgotten, which we can calculate using the following expression:  
\[r_{t}=\sigma(x_{t}W^{r}+h_{t-1}U^{r}) \tag{3}\]  
This expression is the same as the update gate expression, except that the parameters and uses of the linear transformation are different. As described in the previous update gate, \(h_{t-1}\) and \(x_{t}\) first undergo a linear transformation, and then add the _sigmoid_ activation function to output the activation value. We will now discuss, in detail, how these gates affect the final output. In the use of the reset gate, the new memory content will use the reset gate to store information related to the past. Its calculation expression is:  
\[h^{\prime}_{t}=\tanh(x_{t}W^{h}+r_{t}\odot U^{h}h_{t-1}) \tag{4}\]  
The input \(x_{t}\) and the previous time-step information \(h_{t-1}\) first undergo a linear transformation, namely, the right multiplication of the matrices \(W^{h}\) and \(U^{h}\), respectively. The Hadamard product of reset gate \(r_{t}\) and \(U^{h}h_{t-1}\) is calculated, that is, the product of corresponding elements of \(r_{t}\) and \(U^{h}h_{t-1}\). Because the reset gate calculated earlier is a vector of 0 to 1, it measures the size of the gate opening. For example, a gate value of 0 for an element means that information about that element has been completely forgotten. The Hadamard product determines what previous information is to be retained and forgotten. The results of these two parts are then added and put into the hyperbolic tangent activation function. In the last step, the network needs to compute the \(h_{t}\) vector, which will hold the information of the current cell and pass it to the next cell.