# HTSA-LSTM: Leveraging Driving Habits for Enhanced Long-Term Urban Traffic Trajectory Prediction
## 3 Experiments and Evaluation
### Vehicle Speed, Acceleration, and Trajectory Prediction  
To provide a more intuitive demonstration of HTSA-LSTM's predictive performance on other feature variables, this chapter selects Vehicle 1585 from the NGSIM US101 dataset to predict and analyze its longitudinal speed (\(v_{y}\)), longitudinal acceleration (\(a_{y}\)), lateral speed (\(v_{x}\)), and lateral acceleration (\(a_{x}\)). The prediction accuracy is evaluated using the mean absolute error (MAE) between the predicted and actual values:  
\[e=(\sum_{i=0}^{n}|y_{i}-y_{i}|)/n \tag{25}\]  
Figure 11: Standardized frequency distribution of driving primitives. Figure 10: Driving behavior and kinematic features. where \(\hat{y}_{i}\) represents the predicted value of the target vehicle, \(y_{i}\) is the actual value, \(i\) denotes the observation point, and \(n\) is the number of samples. The corresponding mean errors for longitudinal speed \(v_{y}\), longitudinal acceleration \(a_{y}\), lateral speed \(v_{x}\), and lateral acceleration \(a_{x}\) are denoted as \(e[v_{y}]\), \(e[u_{y}]\), \(e[v_{x}]\), and \(e[a_{x}]\). Figure 12 provides examples of predictions for \(v_{y}\), \(a_{y}\), \(v_{x}\), and \(a_{x}\) at different prediction horizons \(H\). The predictions are merged based on the continuity of the time series, presenting combined results for 50 steps (5 s) and 80 steps (8 s) into the future. Figure 13 reveals that the mean error for all predicted variables increases with the prediction horizon. Additionally, during periods of rapid changes in the predicted values, the accuracy of the predictions tends to decrease. For instance, in the prediction of longitudinal speed \(v_{y}\), around the 100 th time step, a sharp transition from rapid deceleration to rapid acceleration occurs. While the predicted trends align with the actual values, there is some discrepancy at the extremities, with the predictions generally being conservative. A similar pattern is observed for other variables around their extreme points. This behavior can be reasonably explained by the distribution of temporal attention weights. As analyzed earlier, the temporal attention weights in the input sequence are primarily concentrated at the current time step (i.e., time \(t\), as shown in Figure 13). In Figure 13, the red solid circle and the hollow circle represent \(e[v_{y}]\), \(e[v_{x}]\), respectively, the black solid rhombus, and the hollow rhombus represent \(e[a_{y}]\), \(e[a_{x}]\), respectively. For the future time series being predicted, this corresponds to the previous time step. Thus, when an extreme value occurs, the model continues to predict based on the trend at time \(t\) and prior, until the temporal attention captures this change. Figure 12: Examples of predictions for \(v_{y}\), \(a_{y}\), \(v_{x}\), \(a_{x}\) for Vehicle 1585 (with H = 5 and H = 8). Figure 13: The relationship between \(e[v_{y}]\), \(e[a_{y}]\), \(e[v_{x}]\), \(e[a_{x}]\), and the prediction horizon. To visually demonstrate HTSA-LSTM's trajectory prediction results, the predicted trajectories are merged based on the continuity of the time series to form long-range trajectory predictions according to the lane distribution in the road network model. Three samples from the NGSIM dataset were selected for trajectory display. The interactions among Vehicles 1585, 1576, and 1583 are depicted in Figure 14: Vehicle 1576 is the lead vehicle before Vehicle 1585's lane change (from lane L4 to lane L5), and Vehicle 1583 is the lead vehicle in the new lane (L5) after the lane change. The results show that HTSA-LSTM's trajectory predictions closely match the actual trajectories of the vehicles. However, during the lane change of Vehicle 1585, the model predicts the lane change slightly earlier than it occurs, which can be considered a conservative strategy. Vehicle 1583 moves toward the opposite side of the lane when its neighboring vehicle (Vehicle 1585) changes lanes into its lane, then gradually returns to the center of the road.