## 3 System Model
### Long Short-Term Memory Network (LSTM)  
Accurate traffic flow prediction demands continuous and uninterrupted forecasting, as traffic characteristics continuously evolve over time. Short-term data, measured in minutes or hours, and long-term data, measured in weeks or months, manifest distinct features. To ensure precision in data prediction, it is essential to consider both the long-term and short-term characteristics of the data. LSTM stands out for its capability to handle long time series and facilitate short-term as well as long-term predictions, making it an ideal choice for traffic flow prediction. LSTM is an algorithm in RNN, which is used to solve the problem of gradient disappearance and gradient explosion in long sequence training. LSTM mitigates the vanishing gradient problem by incorporating a memory cell and a set of gates that regulate the flow of information within the network. The memory cell acts as a long-term storage unit, allowing the network to retain information over longer sequences. The gates, including the input gate, forget gate, and output gate, control the flow of information into and out of the memory cell. The forget gate selectively decides which information to discard from the memory cell, preventing irrelevant information from persisting and reducing the impact of vanishing gradients. The input gate regulates the update of the memory cell with new information, preventing the exploding gradients. These mechanisms enable LSTM to capture long-term dependencies and alleviate the challenges associated with gradient propagation. Therefore, LSTM performs better in longer sequences than ordinary RNNs. The control flow of LSTM is similar to RNN, which processes the data flowing through cells in the process of forward propagation. LSTM is suitable for analyzing long sequence data, and this paper uses the advantage of LSTM to predict long-term traffic flow data [24]. Long-term memory cell:  
\[C_{t}=f_{t}\bigotimes C_{t-1}+i_{t}\bigotimes\widehat{C}_{t} \tag{8}\]  
Short-term memory cell:  
\[h_{t}=O_{t}\bigotimes\tanh(C_{t}) \tag{9}\]  
Forget gate:  
\[f_{t}=\sigma(W_{f}\cdot[h_{t-1},Q_{t}^{\prime}.]+b_{f}) \tag{10}\]  
Input gate:  
\[i_{t}=\sigma(W_{i}\cdot[h_{t-1},Q_{t}^{\prime}.]+b_{i}) \tag{11}\]  
\[\widehat{C}_{t}=\tanh(W_{c}\cdot[h_{t-1},Q_{t}^{\prime}.]+b_{c}) \tag{12}\]  
Output gate:  
\[O_{t}=\sigma(W_{o}[h_{t-1},Q_{t}^{\prime}.]+b_{o}) \tag{13}\]  
The long-term memory cell stores long-term traffic flow information, while the short-term cell stores short-term traffic flow memory information. The long-term memory cell forgets parts of unnecessary long-term traffic flow information through the forgetting gate. The function of the forgetting gate is to decide if information should be discarded or retained. The information from the short-term memory cell and the current input is passed to the sigmoid function at the meantime. The probability that the short-term memory is stored is denoted as \(\sigma(\bullet)=\frac{1}{1+\sigma^{-\bullet}}\). The output value is between 0 and 1. A value closer to 0 means that more probability should be discarded. Otherwise, a value closer to 1 means that more probability should be retained in the new state [25; 26; 27]. The input gate transmits the short-term memory cell of the previous layer and the current traffic flow data to the tanh function to create a new candidate vector \(\widehat{C}_{t}\) and calculates \(i_{t}\) from the short-term memory cell of the previous layer and the current traffic flow data and transfers it to the sigmoid function. The value is modified from 0 to 1, and it is used to determine whether the information needs to be updated. A value of 0 means that the short-term input information is not important and 1 means that it is important. \(\widehat{C}_{t}\)\(i_{t}\) will determine the information that is important and needs to be retained. The output gate is used to determine the value of the next hidden state, which contains the information previously input.