Comparative Analysis of LSTM and PatchTST Models for Urban Street Traffic Time Series Forecasting
Abstract
With the increasing complexity of urban traffic systems, reliable forecasting of road conditions has become an important requirement for congestion management and intelligent transportation applications. This study develops a multivariate and multi-horizon traffic speed forecasting framework using real-world traffic monitoring data collected from 75 street segments in Shenzhen, China. LSTM and PatchTST are selected as representative recurrent and Transformer-based forecasting models for comparative evaluation. Average travel speed is considered the prediction target, while traffic index, total sample travel length, and total sample travel time are incorporated as additional input variables. Historical observations from the previous 48 hours are used to forecast traffic speeds over three future horizons, including 30, 60, and 120 minutes. To increase the dependability of experimental outcomes, the dataset is split chronologically, and several random seeds are used. MAE, RMSE, MAPE, and R2 are used to assess the model's performance. According to the experimental findings, PatchTST consistently outperforms LSTM in predicting across all prediction horizons. The MAE values of PatchTST are 2.0710, 2.1960, and 2.3552 for 30-, 60-, and 120-minute forecasting tasks, corresponding to reductions of 6.81%, 7.86%, and 5.89% compared with LSTM. Meanwhile, PatchTST obtains R² values of 0.8886, 0.8795, and 0.8670, respectively. Although the forecasting accuracy of both models decreases with longer prediction horizons, PatchTST maintains relatively lower errors and better stability. The results indicate that the patch-based representation and attention mechanism provide advantages in capturing both local variations and long-term temporal dependencies in urban traffic sequences.