# HTSA-LSTM: Leveraging Driving Habits for Enhanced Long-Term Urban Traffic Trajectory Prediction
## 2 Model Development
### Traditional Models  
When utilizing traditional neural networks for time-series predictions, a significant limitation arises due to the network's inherent disregard for whether information from a preceding time frame might influence tasks in subsequent moments. This oversight renders traditional neural networks unsuitable for time-series problems. In the context of vehicle trajectory prediction, it is indisputable that driving data from previous time intervals has a substantial impact on subsequent prediction tasks. To address this issue of \"long-term dependency\", Long Short-Term Memory (LSTM) recurrent neural networks were introduced. These LSTM units are capable of analyzing temporal dependencies within the input data to the network. By incorporating gating mechanisms, LSTM units enhance the memory capabilities of standard recurrent units. Specifically, an LSTM consists of a forget gate, an input gate, an output gate, and a memory cell (as illustrated in Figure 2). Several variants of the standard LSTM have emerged, such as LSTMs without forget gates and those with peephole connections. However, in the HTSA-LSTM model, all LSTMs utilized are standard LSTM units. Figure 2 illustrates the traditional LSTM architecture. Forget Gate: Upon receiving input into the LSTM unit, the first task of the LSTM is to determine which information from the cell state should be discarded or \"forgotten\". This decision is governed by the \"forget gate layer\" of the network. The forget gate takes two inputs: the output value from the previous time step \(h_{t-1}\) and the current input value \(x_{t}\). It then determines the resulting information \(f_{t}\), which represents the magnitude of information to be discarded. Each value in the cell state \(c_{t-1}\) is scaled within the range [0, 1], where 1 indicates \"fully retain this state\" and 0 indicates \"completely disregard this state.\" The forget gate's update process is as follows:  
\[f_{t}=\sigma\Big{(}W_{f}\cdot[h_{t-1},x_{t}]+b_{f}\Big{)} \tag{5}\]  
Figure 2: The traditional LSTM architecture. where \(W_{f}\) is the weight matrix, \(b_{f}\) is the bias term, \(h_{t-1}\) is the output value from the previous network unit, \(x_{t}\) is the current network input, and \(\sigma\) is the sigmoid function. Input Gate: After information has been filtered through the forget gate, it is necessary to determine which information should be preserved in the LSTM cell state. This functionality is primarily achieved through the \"input gate\" layer and the tanh layer. The \"input gate\" layer primarily decides which information should be updated, while the tanh layer creates a new candidate vector \(\widetilde{C}_{t}\) that can be integrated into the cell state update. The input gate's update process is as follows:  
\[i_{t}=\sigma(W_{i}\cdot[h_{t-1},x_{t}]+b_{i}) \tag{6}\]  
\[\widetilde{C}_{t}=tanh(W_{C}\cdot[h_{t-1},x_{t}]+b_{C}) \tag{7}\]  
where \(W_{i}\) and \(W_{C}\) are the weight matrices, \(b_{i}\) and \(b_{c}\) are the bias terms, and tanh refers to the hyperbolic tangent function. LSTM Cell State Update: The process of updating the cell state involves transitioning the old state \(c_{t-1}\) to the new state \(c_{t}\). Following the selection of information by the forget gate and the input gate, the cell state is multiplied by the value \(f_{t}\) determined by the forget gate. This result signifies that the forget gate has opted to discard certain information. Subsequently, the value from the input gate is multiplied by the candidate vector \(\widetilde{C}_{t}\) and added to the output from the forget gate, thereby incorporating some new information into the cell state. The cell state update is expressed as:  
\[C_{t}=f_{t}\bigodot C_{t-1}+i_{t}\bigodot\widetilde{C}_{t} \tag{8}\]  
where \(f_{t}\) represents the weight from the forget gate, \(f_{t}\bigodot C_{t-1}\) denotes the output of the forget gate, \(i_{t}\) is the value from the input gate, and \(i_{t}\bigodot\widetilde{C}_{t}\) represents the new candidate value.