## 3 Methodology  
### Short-Term Dynamic Prediction Mechanism Based on Sliding Time Windows  
Urban road travel time-series data typically exhibit periodicity and trends in data segments with the same starting and ending points, such as the same weekdays (e.g., Monday of last week and Monday of next week), the same non-working days, and the same seasons. However, urban road travel times are continuously influenced by various external factors, including traffic incidents, traffic demand fluctuations, and sudden weather changes. This gives travel time data randomness from one or multiple factors, posing significant challenges for accurate and stable short-term urban road travel time prediction.  
Short-term dynamic prediction mechanisms based on sliding time windows are generally adopted for prediction purposes as shown in Figure 1. Consider historical travel time data on a specific road segment or specific route \(X=\{x_{1},x_{2}\cdots,x_{T}\}\), the objective of short-term travel time prediction is to forecast travel times \(X_{m}=\{x_{T+1},\cdots,x_{T+m}\}\) at one or multiple time steps \(\{T+1,\cdots,T+m\}\) (\(m\geq 1\)) ahead. The parameter \(m\) represents the length of prediction time steps, commonly referred to as the prediction horizon or forecast horizon. A sliding time window with a certain time step length moves along the temporal axis of travel time-series data and predicts travel times beyond the current time step based on the travel time data within that time window. This type of prediction is also known as real-time prediction, online prediction, or dynamic prediction.  
The specific process includes the following:  
(1) Dataset partitioning: First, divide the data into training sets (or training and validation sets) and test sets. For shallow learning models other than artificial neural networks, since they do not require validation sets or can use cross-validation methods to automatically partition different validation sets from the training set for training and validation, the original dataset can be divided into only training and test sets. For deep learning models, since cross-validation methods are not commonly used, the dataset needs to be divided into training, validation, and test sets.  
(2) Sliding time window construction: Define the sliding time window width as k and the prediction scale as h. Currently, one sliding time window contains travel time data for k time steps. Then, reshape the original training set according to the travel time data contained in the sliding time window corresponding to each time step in [1,T] and the travel time data corresponding to the prediction scale to construct the training set.  
(3) Model training: Train the prediction model based on the constructed training set data. The sample input to the model each time is the data point of the sliding time window corresponding to each time step and the dependent variable sample. Through training based on data from each time step, the model can be finally trained and make predictions based on independent variable sample inputs for each future time step.  
(4) Model validation: Use the validation set to evaluate model performance and adjust model parameters.  
(5) Model testing: Test model performance on the test set and evaluate its generalization capability.  
This sliding time window-based short-term dynamic prediction mechanism can fully utilize historical information from time-series data to improve prediction accuracy, making it particularly suitable for urban road travel time data characterized by high volatility and randomness.