First, one-minute traffic data are acquired from the TomTom Junction Analytics system (Step 1). The dataset contains multiple traffic-related variables collected at a major urban roundabout in Jeddah. To preserve temporal integrity, incomplete or corrupted samples are removed and the remaining records are arranged chronologically (Step 2).
Next, the input variables used for prediction are defined (Step 3). These variables include travel time (travelTimeSec), delay (delaySec), usual delay (usualDelaySec), number of stops (stops), queue length (queueLengthMeters), and historical traffic volume (previousVolumePerHour). The target output variable is defined as the current traffic volume per hour (volumePerHour), which represents the primary response variable of the prediction task (Step 4).
The dataset is then partitioned into training and testing subsets to ensure that test observations are not used during model development, thereby maintaining the reliability of the evaluation process (Step 5). As part of the preprocessing stage, the input variables are normalized using statistics derived exclusively from the training data to ensure consistent scaling and numerical stability.
Following data preprocessing, baseline and optimized machine learning (ML) models are trained (Step 6). These models include linear regression, decision tree–based models, support vector regression, and ensemble learning techniques. In parallel, baseline and optimized deep learning (DL) models, including LSTM and GRU architectures, are developed to capture temporal dependencies inherent in traffic data (Step 7).
After model training, traffic volume predictions are generated for the test dataset (Step 8). The predicted values are then transformed back to their original scale using inverse normalization to enable direct comparison with the observed traffic volumes (Step 9). The predictive performance of each model is evaluated using several statistical error metrics (Step 10). Finally, baseline and optimized models across both ML and DL configurations are compared using quantitative metrics and visual analyses to assess prediction accuracy and robustness (Step 11).
2.1. Data Description and Preprocessing
The proposed study utilizes real-time traffic data obtained from the Earth Globe Roundabout in Jeddah, Saudi Arabia. This major urban intersection experiences heavy traffic demand. The real-time traffic data has been collected using TomTom Junction Analytics platform and comprise one-minute resolution measurements gathered during the month of March. It should be noted that TomTom Junction Analytics provides probe-based traffic estimates derived from floating vehicle data rather than direct sensor measurements. Consequently, the dataset may contain estimation uncertainty inherent to probe-based traffic analytics. However, the use of high-resolution, probe-based traffic data guarantees that the ensuing modeling process is anchored in real-world traffic conditions and facilitates dependable data-driven forecasting.
Prior to model development, the dataset was carefully examined to identify missing values, inconsistencies, and temporal misalignments. All traffic variables were synchronized to a common one-minute time scale to ensure temporal consistency across the observations. Records containing incomplete or corrupted entries were removed during the preprocessing stage.
The final dataset covers the entire month of March 2025, spanning from 1 March 2025 (00:00) to 31 March 2025 (23:59), and contains 44,622 one-minute observations collected at the Earth Globe Roundabout in Jeddah, Saudi Arabia. The dataset includes both weekdays (Sunday–Thursday) and weekends (Friday–Saturday), providing a comprehensive representation of typical urban traffic conditions. The observation period partially overlaps with the Ramadan season in Saudi Arabia, which may influence travel demand patterns due to changes in daily activity schedules. No days were removed due to missing data or sensor failures, ensuring continuous temporal coverage throughout the study period.
The study utilizes a data-driven framework to facilitate a consistent and fair comparative evaluation of the selected prediction models, defining input and output variables based on measurable traffic conditions commonly found in modern Intelligent Transportation Systems (ITS). There are two main reasons for choosing the variables: (i) to accurately show the important operational characteristics of urban traffic flow at intersections, and (ii) to make sure that the chosen features are useful for predicting short-term traffic volume in real-world situations. The proposed formulation employs traffic indicators that reflect both current conditions and short-term temporal context, allowing the models to effectively encapsulate congestion dynamics, traffic unpredictability, and short-term dependencies in a realistic and operationally relevant manner. As shown below, the traffic dataset is organized by listing a set of explanatory input variables and one target output variable.
The selected input variables are:
travelTimeSec: Travel time through the junction approach (seconds);
delaySec: Observed traffic delay relative to free-flow conditions (seconds);
usualDelaySec: Typical delay expected for the same time of day and day of week (seconds);
stops: Average number of stops per vehicle;
queueLengthMeters: Estimated queue length on the approach (meters);
previousVolumePerHour: Traffic volume observed in the previous time step (vehicles/hour).
The selected output variable is:
For improved readability, the variable names shown in tables are presented in simplified descriptive form (e.g., Travel Time (s) instead of travelTimeSec), while maintaining the same definitions and measurement units as the original dataset variables.
Table 1 presents a representative sample of the traffic dataset collected at the Earth Globe Roundabout in Jeddah during March 2025. Each record captures the instantaneous traffic state at the junction, combining temporal information (date and time) with multiple operational traffic indicators. The variables reflect key aspects of traffic performance, including travel time, observed and usual delays, stopping behavior, queue formation, and traffic volume. As illustrated in the table, noticeable variations occur over consecutive minutes, even within a short time window, highlighting the highly dynamic nature of urban traffic flow. For instance, fluctuations in travel time and delay are accompanied by changes in queue length and traffic volume, indicating the interaction between congestion buildup and discharge processes at the junction. This fine-grained temporal variability underscores the need for predictive models capable of capturing rapid short-term changes and complex temporal dependencies.
Specifically, the sample records show that periods with higher travel time and delay values (e.g., at 01:44–01:46) are associated with longer queues and elevated traffic volumes, whereas lower travel time and delay values (e.g., at 01:47–01:48) coincide with reduced queue lengths and a noticeable decline in traffic volume. This relationship illustrates how congestion intensity and queue dynamics directly influence short-term traffic load, confirming the suitability of the dataset for short-term traffic volume prediction under real operational conditions.
To better characterize the dataset used for model development, descriptive statistics were computed for all traffic variables involved in the prediction framework.
Table 2 presents the main statistical indicators, including the mean, standard deviation, minimum, median, and maximum values. These statistics provide an overview of the variability and distribution of traffic conditions at the Earth Globe Roundabout during the observation period.
The results indicate substantial variability in traffic conditions at the Earth Globe Roundabout. The average traffic volume is approximately 2326 vehicles per hour, with peak values approaching 9000 vehicles per hour during high-demand periods. Similarly, the average vehicle delay is approximately 30 s, while extreme congestion conditions may increase delays to more than 300 s. These variations highlight the dynamic and nonlinear nature of traffic conditions at the study location, which motivates the application of advanced machine learning and deep learning models for short-term traffic prediction.
To further illustrate the temporal characteristics of the traffic conditions,
Figure 2 and
Figure 3 present the diurnal patterns of traffic volume and vehicle delay aggregated by hour of day.
Figure 2 shows that traffic demand follows a clear daily cycle, with lower traffic volumes during nighttime hours and pronounced increases during daytime and evening periods. The peak traffic volumes occur during the late afternoon and evening hours, reflecting typical urban commuting patterns.
Figure 3 presents the corresponding hourly delay pattern, which closely follows the variations in traffic demand. Delay values remain relatively low during off-peak hours but increase significantly during periods of higher traffic volume. The interquartile ranges shown in both figures highlight the variability of traffic conditions throughout the day, indicating that the traffic system experiences both stable low-demand periods and highly variable peak periods. These temporal dynamics demonstrate the complexity and nonlinearity of traffic behavior at the studied roundabout, reinforcing the need for advanced prediction models capable of capturing short-term traffic fluctuations.
These observed temporal patterns confirm the presence of strong daily traffic regimes, which further motivates the need for predictive models capable of capturing both short-term fluctuations and recurring traffic cycles.
To enhance numerical stability, accelerate model convergence, and ensure balanced feature contribution across variables with different physical scales, z-score normalization was applied to all input variables. Each input feature
was normalized according to:
where
and
denote the mean and standard deviation of the corresponding feature, respectively. Importantly, these statistics were computed exclusively from the training dataset and subsequently applied to the testing dataset to prevent information leakage and preserve the integrity of the evaluation process. This normalization strategy is particularly important for learning algorithms, as it prevents features with larger numerical ranges from dominating the training process and improves the stability of optimization across different model types.
Following model inference, all predicted traffic volumes were transformed back to their original scale prior to performance evaluation. This ensured that error metrics were computed in physically interpretable units (vehicles/hour), facilitating meaningful comparison across models.
To preserve temporal dependencies and reflect realistic deployment conditions, the dataset was partitioned chronologically rather than using random sampling. First, 80% of the observations were used as the development set, while the remaining 20% were strictly held out as an independent test set for final performance evaluation. Within the development set, the last 10% of the timeline was reserved as a validation subset, while the remaining 90% was used for model training. Consequently, the effective dataset split corresponds approximately to 72% training, 8% validation, and 20% testing, all defined chronologically.
This design ensures that the test data represent unseen future observations and are not used during model development, thereby providing a realistic evaluation of model performance for future traffic prediction.
To prevent information leakage during model development, all hyperparameter optimization procedures were restricted to the training data. For the machine learning (ML) models implemented in the MATLAB R2025b Regression Learner App, Bayesian hyperparameter optimization was conducted using internal k-fold cross-validation within the training subset only. For deep learning models (LSTM and GRU), the training portion was chronologically divided into a training block and a validation block, where the validation block corresponds to the last segment of the development set. Bayesian optimization minimized the validation RMSE on normalized targets, and after the optimal hyperparameters were identified, the final model was retrained on the full training subset and evaluated once on the untouched test set.
To enable short-term temporal learning for the recurrent deep learning models, the multivariate traffic time series was converted into a sliding-window sequence representation with a window length of 10 min (i.e., 10 consecutive one-minute observations). Each input sample therefore consists of a 10-step temporal sequence of the six explanatory variables, representing the traffic conditions during the previous 10 min, while the target output corresponds to the traffic volume at the next prediction step. This sequence formulation allows the recurrent networks to capture short-term temporal dependencies and dynamic traffic fluctuations. The windowing procedure was applied consistently to both baseline and optimized deep learning models while maintaining the chronological data split and strict isolation of the test dataset.
2.2. Prediction Models
Based on the data preparation, normalization, and chronological partitioning described in the previous section, short-term traffic load prediction is formulated as a supervised learning problem. This study evaluates a set of regression-based machine learning (ML) and deep learning (DL) models within a systematic comparative framework. All models are trained and tested using the same input–output formulation, normalized feature space, and training–testing split to ensure a fair and consistent performance comparison.
The modeling process encompasses three main stages: model development, prediction, and performance evaluation. Both baseline and optimized model configurations are considered to assess robustness under varying traffic conditions. Where applicable, hyperparameter tuning is conducted using Bayesian optimization with an expected improvement acquisition function, providing an efficient and objective parameter selection process without manual intervention. For regression-based models, Bayesian optimization was conducted using internal 5-fold cross-validation within the training set. For deep learning models, all hyperparameter tuning and model development procedures were restricted to the training subset. The test set was strictly reserved for final performance evaluation to avoid information leakage.
2.2.1. Regression-Based Machine Learning Models
Regression-based ML models were developed to provide baseline and advanced predictive benchmarks for short-term traffic load forecasting. For each approach, a baseline configuration was first implemented, followed by an optimized version in which key hyperparameters were tuned to enhance predictive accuracy and generalization capability. All models utilized the same six input features—travel time, delay, usual delay, number of stops, queue length, and previous traffic volume—without applying dimensionality reduction in order to preserve the physical interpretability of traffic features and ensure a fair comparison across models.
Linear Regression (LR) was employed as a baseline model to capture linear relationships between traffic-related variables and hourly traffic volume. The model was formulated using ordinary least squares estimation and trained using all six input features without regularization or feature transformation. As LR does not involve tunable hyperparameters in the present formulation, no optimized variant was considered. This model serves as a reference for evaluating the performance gains achieved by nonlinear methods.
Regression tree models were used to capture nonlinear decision structures in traffic data. The baseline median tee configuration, referred to as Med Tree, employed a single regression tree with a minimum leaf size of 12, with surrogate decision splits disabled to control model complexity.
The optimized regression tree model, referred to as OptTree, was developed by tuning the minimum leaf size parameter using Bayesian optimization. The optimization process explored a wide search range and selected a minimum leaf size of 50, which improved model generalization by reducing overfitting while preserving interpretability.
Support Vector Machine (SVM) models were applied to represent nonlinear traffic patterns using a kernel-based learning framework. The baseline SVM employed a Gaussian kernel with a kernel scale of 0.61, while the box constraint and epsilon parameters were automatically selected. Input data standardization was not applied.
The optimized SVM variant (OptSVM) was obtained through Bayesian hyperparameter optimization. The optimization process selected a quadratic kernel function, a box constraint of 0.0034, and an epsilon value of 0.0571. These adjustments enabled the optimized SVM to achieve improved predictive accuracy and robustness compared to the baseline configuration.
Ensemble learning models were developed to enhance robustness by aggregating multiple regression trees. The baseline Ensemble model employed a bagging strategy consisting of 30 regression trees, each with a minimum leaf size of 8. Predictions were obtained by averaging the outputs of individual learners.
The optimized ensemble model (OptEnsemble) adopted a boosting-based strategy using Least Squares Boosting (LSBoost). Bayesian optimization was applied to tune key hyperparameters, including the number of learners, learning rate, minimum leaf size, and the number of predictors sampled at each split. The optimized configuration consisted of 174 learners, a learning rate of 0.2798, and a minimum leaf size of 1, resulting in enhanced predictive performance.
Feedforward neural networks were employed as nonlinear regression models. The baseline neural network (NN) consisted of a single hidden layer with 25 neurons and a sigmoid activation function. The model was trained for 50 iterations without regularization, providing a nonlinear baseline with moderate complexity.
The optimized neural network model (OptNN) was developed by tuning network depth, neuron counts, activation functions, and regularization strength. The optimized configuration consisted of three fully connected hidden layers with neuron sizes of 29, 1, and 1, respectively, and a regularization parameter of . Bayesian optimization was employed to identify optimal architecture and parameter values. This configuration was selected automatically by Bayesian optimization, indicating that a simpler architecture was sufficient for capturing the dominant patterns in the dataset.
2.2.2. Deep Learning Models
To capture temporal dependencies and sequential traffic patterns inherent in high-resolution traffic data, deep learning (DL) models based on Long Short-Term Memory (LSTM) and Gated Recurrent Unit (GRU) architectures were developed. Both architectures were evaluated under baseline and optimized configurations to examine the impact of hyperparameter tuning on predictive performance. All deep learning models processed multivariate traffic sequences using a sequence-to-one learning strategy, enabling effective modeling of short-term dynamics and temporal correlations in the observed traffic conditions.
The proposed deep learning framework receives a short historical window of multivariate traffic observations and predicts the traffic volume at the next time step. In the present study, the input sequence length was set to 10 time steps (corresponding to 10 min of historical data), while the prediction horizon was one minute ahead. Each input sequence contains six explanatory variables representing the traffic state, namely travel time, delay, usual delay, stops, queue length, and the previous traffic volume.
For both LSTM and GRU architectures, the baseline configuration consists of a single recurrent layer followed by a fully connected layer and a regression output layer. The baseline models use 32 hidden units, a mini-batch size of 128, and are trained for 50 epochs using the Adam optimizer with an initial learning rate of 0.01. To improve numerical stability during training, gradient clipping with a threshold value of 1 was applied. The chronological order of the time-series data was preserved during training by disabling data shuffling.
Hyperparameter tuning was conducted using Bayesian optimization to systematically explore the configuration space of the deep learning models. The optimization process considered four key hyperparameters: the number of hidden units (10–60), the maximum number of training epochs (10–60), the initial learning rate (10−2–10−1), and the learning rate drop factor (10−2–0.5). Logarithmic scaling was applied to the learning rate and drop factor to enable efficient exploration across several orders of magnitude.
The objective function minimized the validation mean squared error (MSE) computed on a temporally separated validation subset extracted from the training data. A maximum set of 50 Bayesian optimization iterations was performed using the expected-improvement acquisition function. This procedure ensured that model tuning was conducted exclusively on the training data, preventing information leakage from the test set and enabling a fair comparison of model performance. The final hyperparameter configurations selected by the Bayesian optimization procedure are summarized in
Table 3.
The optimized LSTM model employed 54 hidden units and was trained for 13 epochs with an initial learning rate of 0.024567 and a learning rate drop factor of 0.20802. The optimized GRU model used 52 hidden units and 47 training epochs, with an initial learning rate of 0.010397 and a drop factor of 0.058149. These configurations correspond to the best-performing solutions identified during the 50 optimization iterations based on the minimum validation error.
2.3. Model Evaluation Metrics
Model performance was evaluated by using multiple statistical error metrics to provide a comprehensive assessment of prediction accuracy and robustness. The selected metrics quantify different aspects of performance, including error magnitude, sensitivity to scale, and goodness of fit. All metrics were computed on the test dataset after applying inverse normalization to restore predicted traffic volumes to their original physical scale (vehicles/hour), ensuring an interpretable and consistent comparison across models.
The evaluation metrics used in this study are defined as follows:
Mean Squared Error (MSE):
where
represents the actual traffic volume,
denotes the predicted traffic volume, and
is the total number of test samples.
Root Mean Squared Error (RMSE):
RMSE penalizes large errors more heavily and is widely used in traffic forecasting due to its sensitivity to significant deviations.
Mean Absolute Error (MAE):
MAE provides a direct measure of average prediction error magnitude and is less sensitive to outliers than RMSE.
Symmetric Mean Absolute Percentage Error (sMAPE):
sMAPE expresses prediction accuracy as a percentage using a symmetric formulation that reduces the bias of traditional MAPE, particularly when actual values are close to zero. In cases where both actual and predicted values approach zero, a small numerical constant was added to the denominator to prevent division-by-zero errors.
Coefficient of Determination (R
2):
where
denotes the mean of the observed traffic volumes.
measures the proportion of variance in the observed data explained by the model.