## 3 Construction of OD Passenger Flow Prediction Deep Learning Model
### Long Short-Term Memory Network Model  
Long short-term memory (LSTM) is a variant of the Recurrent Neural Network (RNN). Compared with the RNN, the gradient disappearance can only be short-term memory through the gating mechanism; that is, LSTM introduces three gate structures: forget gate, input gate, and output gate in the RNN. An LSTM network combines short-term memory and long-term memory to learn long-term dependence in input data, and its structure is shown in Figure 7.  
Figure 5: Dilated convolutions.  
Figure 6: Dilated convolutions with residual connection.  
Figure 7: LSTM model structure.  
In the LSTM network, the activation function of the forget gate, input gate, and output gate is the Sigmoid function, and the activation function of the model output is the Tanh function. The expressions of these two functions and the corresponding derivative are calculated as follows:  
\[\sigma(z)=y=\frac{1}{1+e^{-z}} \tag{1}\]  
\[\sigma\prime(z)=y(1-y) \tag{2}\]  
\[f(x)=\frac{e^{z}-e^{-z}}{e^{z}+e^{-z}} \tag{3}\]  
\[f\prime(x)=1-y^{2} \tag{4}\]  
The training process of the LSTM model can be roughly divided into the following four steps:  
Step 1: After the input data \(x_{t}\) at time t are input into the LSTM model, the forget gate begins to decide whether to discard the old data from the unit state \(C_{t-1}\) at the previous moment. This step is calculated as follows:  
\[f(t)=\sigma(W_{f}.[h_{t-1},x_{t}]+b_{f}) \tag{5}\]  
where \(W_{f}\) is the weight matrix of the forget gate, which combines with vectors \(h_{t-1}\) and \(x_{t}\) to obtain a new vector group \([h_{t-1},x_{t}]\), and the bias term of the forgetting gate is denoted by \(b_{f}\).  
Step 2: The input gate determines how much data can be saved in the unit state \(C_{t}\) at time \(t\). During this process, it is possible to prepare and retain the necessary data, removing irrelevant data. This step is calculated as follows:  
\[i_{t}=\sigma(W_{i}.[h_{t-1},x_{t}]+b_{i}) \tag{6}\]  
where \(W_{i}\) is the weight matrix of the input gate, and \(b_{i}\) is the corresponding bias term.  
Step 3: Then, the tanh function is used to generate the candidate value of the unit state \(C_{t}\) corresponding to t at \(C_{t}\). This step is calculated as follows:  
\[\widetilde{C}_{t}=\tanh(W_{c}.[h_{t-1},x_{t}]+b_{c}) \tag{7}\]  
In this process, \(W_{c}\) and \(b_{c}\) in the above equation are used to calculate the corresponding candidate states. Combining Step 1 and Step 2, the unit state \(C_{t-1}\) of the previous moment is updated, the Sigmoid function is used to select the content that needs to be updated, and the tanh function is used to update the candidate states. The symbol \({}^{\circ}\) indicates multiplication by the corresponding element. Step 3 is calculated as follows:  
\[C_{t}=f_{t}*C_{t-1}+i_{t}*\widetilde{C}_{t} \tag{8}\]  
Step 4: The output gate determines the output value \(O_{t}\) at the current time. This relationship is expressed as follows:  
\[O_{t}=\sigma(W_{o}.[h_{t-1},x_{t}]+b_{o}) \tag{9}\]  
\(W_{o}\) and \(b_{o}\) are the weight matrix and bias term of the output gate, respectively, and the hidden layer state \(h_{t}\) at time t is related to the cell state.