category: literaturenote citekey: emenikeoptimizedpredictivemodellinghighway2026 title: Optimized predictive modelling for highway traffic flow using real world data authors: "Emenike, Chuks Christian; Bhero, Ernest; Twala, Bhekisipho" year: 2026 date: 2026-04-10 2026-04-10 doi: 10.1016/j.sciaf.2026.e03330 publication: Scientific African url: "https://www.sciencedirect.com/science/article/pii/S2468227626001559" zotero_key: UZLUCBLR zotero_storage: TPGH74JD collections: magistritöö / kohalikud teed folder: 001_artiklid firstAuthor: "Emenike, Chuks Christian"
Optimized predictive modelling for highway traffic flow using real world data
Chuks Christian Emenike, Ernest Bhero, Bhekisipho Twala
PII: S2468-2276(26)00155-9
DOI: https://doi.org/10.1016/j.sciaf.2026.e03330
Reference: SCIAF 3330 To appear in: Scientific African Received date : 28 September 2024 Revised date : 18 March 2026 Accepted date : 26 March 2026
Please cite this article as: C.C. Emenike, E. Bhero and B. Twala, Optimized predictive modelling for highway traffic flow using real world data, Scientific African (2026), doi: https://doi.org/10.1016/j.sciaf.2026.e03330.
This is a PDF of an article that has undergone enhancements after acceptance, such as the addition of a cover page and metadata, and formatting for readability. This version will undergo additional copyediting, typesetting and review before it is published in its final form. As such, this version is no longer the Accepted Manuscript, but it is not yet the definitive Version of Record; we are providing this early version to give early visibility of the article. Please note that Elsevier's sharing policy for the Published Journal Article applies to this version, see: https://www.elsevier.com/about/policiesand-standards/sharing#4-published-journal-article. Please also note that, during the production process, errors may be discovered which could affect the content, and all legal disclaimers that apply to the journal pertain.
© 2026 Published by Elsevier B.V. This is an open access article under the CC BY-NC-ND license (http://creativecommons.org/licenses/by-nc-nd/4.0/).
Graphical Abstract Click here to access/download;Graphical abstract;Graphical Abstract.jpg
Chuks Christian Emenikea , Ernest Bheroa , and Bhekisipho Twalab
aDiscipline of Electrical, Electronic and Computer Engineering, University of KwaZulu-Natal, Durban, 4041, South Africa bDeputy Vice-Chancellor, Digital Transformation, Tshwane University of Technology, Pretoria, South Africa
Journal Pre-proof Traffic congestion undermines mobility, economic productivity, and safety in rapidly urbanising regions, yet evidencebased hourly traffic-flow forecasting studies using real-world South African freeway data remain limited. This study addresses this gap by developing and rigorously benchmarking machine-learning models for hourly traffic-volume prediction on the N3 Durban – Pietermaritzburg corridor national motorway using continuous count-station observations. A unified modelling pipeline was implemented comprising preprocessing, standardisation, an 80:20 holdout split, and 10-fold cross-validated hyperparameter optimisation using GridSearchCV. Four algorithms namely k-Nearest Neighbours, Decision Tree, Support Vector Regression (SVR), and Multi-Layer Perceptron (MLP) were trained and evaluated using R², RMSE, and MAE. SVR achieved the best overall performance, with an R² = 0.9952, RMSE = 36.25 and MAE = 36.11, closely followed by MLP (R² = 0.9952). The key advance is a reproducible, like for like comparative evaluation of multiple machine learning models under identical validation and tuning conditions for an under-studied African freeway context, providing an empirical performance ranking and practical guidance on model selection for hourly forecasting. These findings support data-driven operational planning and intelligent transport interventions on strategic corridors and offer a transferable benchmarking framework for similar emerging economy highway networks.
Keywords: Artificial Intelligence Modeling, Machine Learning Prediction;, Machine Learning Techniques, Traffic Prediction, Traffic Volume Prediction.
Traffic congestion remains a persistent challenge in rapidly motorising and urbanising regions, with impacts that include travel time unreliability, increased fuel use and emissions, degraded safety, and reduced economic productivity [1–3]. Effective mitigation requires both strategic infrastructure planning and operational interventions grounded in reliable traffic information. Short-term traffic flow prediction supports proactive traffic management, dynamic route guidance, and evidence based planning by anticipating near future traffic conditions from historical observations and related explanatory variables [4,5].
Advances in artificial intelligence and machine learning (ML) have strengthened forecasting capability within intelligent transportation systems (ITS), where models can learn nonlinear and time varying relationships between traffic volume and multi-dimensional predictors [4–7]. Recent reviews consistently highlight the effectiveness of ML and deep learning approaches for short-term traffic prediction and emphasise the importance of robust validation and computational considerations for operational deployment [6–8].
In South Africa, congestion pressures are pronounced along strategic economic corridors where commuter and freight movements concentrate. National efforts have supported ITS deployment, including freeway management initiatives and policy development aimed at improving corridor operations and safety [9,10]. Demand is intensified by population concentration in Gauteng and KwaZulu-Natal [11,12], reinforcing the need for accurate short-term forecasting tools to support traffic operations and infrastructure decision making.
Despite extensive global research, evidence remains limited for South African freeway environments particularly for hourly traffic volume prediction using real world continuous count station data. Existing South African machine learning studies have largely focused on Gauteng and on intersection or urban contexts rather than national freeway
corridors [13–15]. This constitutes an important gap because freeway networks carry critical commuter and logistics flows and require reliable short-term forecasts for operational control, incident preparedness, and performance monitoring.
The N3 national motorway linking Durban and Johannesburg is one of South Africa's most economically significant routes, connecting the country's main port to inland industrial and commercial centres and serving as a key logistics conduit [16,17]. Given its strategic role and high demand, the N3 provides a valuable case study for developing data driven hourly traffic forecasting methods tailored to an underrepresented African freeway context.
Accordingly, this study develops and systematically evaluates ML models for hourly traffic-volume prediction on the N3 motorway using continuous count-station observations. A unified modelling framework is implemented to enable fair comparison across algorithms under consistent preprocessing, validation, and hyperparameter optimisation settings. Four supervised learning methods namely k-Nearest Neighbours (KNN), Decision Tree regression, Support Vector Regression (SVR), and Multi-Layer Perceptron (MLP) are benchmarked because they represent distinct modelling paradigms commonly adopted in traffic forecasting [5–8].
This work makes three contributions. First, it provides a comparative benchmark of multiple ML models for hourly freeway traffic prediction using real world South African count-station data. Second, it reports reproducible performance under identical cross-validated tuning and evaluation settings to support evidence-based model selection. Third, it provides a transferable methodological template to support ITS stakeholders in corridor operations, planning, and monitoring on strategic freeway networks.
Journal Pre-proof The research methodology employed is depicted in Figure The rest of this article is divided into the following sections. A review of related literature is found in Section 2. The machine learning methods are suggested in Section 3: k-NN, Decision Trees, SVR, and Multilayer Perceptron algorithms. Section 4 provides empirical studies describing the dataset, the experimental setup or methodology, and the chosen optimization or parameter search strategy. Results and discussion are presented in Section 5, and the conclusion and suggestions resulting from this effort are presented in Section 6.
Figure 1: Research Methodology.
Artificial Intelligence (AI) techniques have increasingly been adopted for traffic flow prediction due to their ability to model nonlinear and time dependent relationships inherent in transportation systems. Within this domain, machine learning (ML) and deep learning approaches have demonstrated growing dominance over traditional statistical models in intelligent transportation systems (ITS), particularly for short-term traffic forecasting tasks [10–14]. These studies emphasise that ML methods are better suited to handle large scale historical datasets and dynamically evolving traffic conditions than classical regression-based techniques.
A wide range of ML models has been investigated for traffic flow prediction. Artificial Neural Networks (ANNs), including multilayer perceptrons (MLPs), have been widely applied and have demonstrated strong predictive capability in short-term forecasting scenarios [20,22]. Support Vector Machines (SVM) and Support Vector Regression (SVR) have similarly shown competitive performance, particularly when traffic patterns exhibit nonlinear characteristics [12,19]. Random Forest (RF), k-Nearest Neighbours (KNN), and ensemble based approaches have also been
explored to improve robustness and generalisation [16,21,29]. Comparative studies indicate that while deep learning architectures such as Long Short-Term Memory (LSTM) networks often outperform conventional ML algorithms in complex urban contexts, model performance remains highly dependent on data characteristics, temporal granularity, and computational constraints [14,23–26].
Recent research has extended prediction frameworks to incorporate hybrid and ensemble models, combining neural architectures with optimisation strategies or integrating multiple learning paradigms to enhance accuracy and reduce prediction error [18,32]. Furthermore, real-time traffic prediction within vehicular and Internet of Vehicles (IoV) environments has been investigated, with attention given not only to predictive accuracy but also to computational efficiency and operational feasibility [19,28]. Collectively, these studies demonstrate the global maturity of ML-based traffic forecasting research.
Within the South African context, however, published studies remain comparatively limited. Existing work has largely focused on urban intersections or selected freeway segments within Gauteng Province [33–35]. For example, ANN-based models have been implemented for signalised intersections and specific motorway sections, while Bayesian approaches have also been explored for motorway prediction tasks. Nevertheless, these studies are geographically concentrated, predominantly intersection-based, and typically lack systematic comparative evaluation across multiple ML algorithms.
Notably, there is a paucity of research addressing hourly traffic volume prediction on national freeway corridors in KwaZulu-Natal. Moreover, many international studies rely on publicly available benchmark datasets, whereas fewer investigations utilise continuous count station data obtained directly from strategic highway infrastructure. This distinction is important because national freeways exhibit traffic dynamics that differ substantially from urban intersections, including higher freight proportions, bidirectional stream interactions, and pronounced weekday weekend variability.
The N3 corridor, linking Durban and Johannesburg, represents one of South Africa's most critical freight and commuter routes [39,40]. Despite its economic significance, no published study has systematically benchmarked multiple ML algorithms for hourly traffic-volume prediction on this corridor using real world continuous highway data. This absence of freeway focused, region specific empirical evaluation constitutes a clear gap in the literature.
Journal Pre-proof Accordingly, this study addresses the identified gaps by establishing a unified, cross-validated modelling framework applied to real-world motorway data from an underrepresented African transport context. Unlike many prior studies that rely on a single predictive model or publicly available benchmark datasets, the present work systematically benchmarks four machine learning algorithms KNN, Decision Tree regression, SVR, and MLP under identical preprocessing and validation conditions. This reproducible comparative framework enables objective assessment of model robustness and performance trade offs. The results indicate that optimised Support Vector Regression (SVR) achieves superior predictive performance under hourly aggregation conditions, providing practical guidance for transport agencies seeking accurate yet computationally efficient forecasting tools for national freeway management.
In most cases, the appropriate algorithm to tackle a machine learning problem is not known in advance. The exploration of machine learning algorithms, particularly those prevalent in the machine learning problem under investigation, has been advised by experts to be first utilized [36,37]. Four machine learning techniques, including K-Nearest Neighbors (KNN), Support Vector Regression (SVR), Decision Trees, and Multi-Layer Perceptron (MLP), commonly known as Artificial Neural Networks (ANN), were taken into consideration in this study.
The KNN algorithm is widely used in machine learning and is often referred to as a lazy learner. This is because it uses the entire dataset to classify unlabeled data points by assigning them to the closest class while considering their distance from one another. Some of the popular distance measures are listed in the equations below. It is a type of supervised learning invented around 1951 by Evelyn Fix and Joseph Hodges. Later, Thomas Cover improved on it. The main advantage of KNN is that it is easy and straightforward.
Euclidean Distance = $$\sqrt{\sum_{i=1}^{K} (X_i - Y_i)^2}$$ (1)
$$Manhanttan \ Distance = \sum_{i=1}^{K} |X_i - Y_i|$$ (2)
Minkowski Distance = $$\left(\sqrt{\sum_{i=1}^{K} (|X_i - Y_i|)^q}\right)^{1/q} \quad q \ge 1$$ (3)
where, correspondingly, X and Y represent the actual and expected traffic volumes.
Decision Trees classifiers are very powerful and widely used in classification and regression supervised machine learning problems. They are also very popular only headed by deep neural networks. To solve problems, tree-like representations are used, where the leaf node represents a class, and the inside node contains properties. The best traits are statistically chosen, and the decision tree is built using a recursive divide and conquer method from the top down. The formula for calculating decision trees is shown in equation (4).
$$Entropy = \sum_{i=1}^{C} -P_i * \log_2(P_i)$$ (4)
Journal Pre-proof The support vector machine (SVM) regression classifier is called the support vector regression (SVR). It is a supervised machine learning approach that uses statistics to solve regression problems. [27]. With tiny datasets and high dimensional feature spaces, SVM performs exceptionally well. It works with both linear and non-linear data and successfully overcomes the problem of dimensionality. [28]. When dealing with linear data, it locates a hyperplane with the maximum margin, then calculates the largest distance between the support vectors, or points closest to the margin edge, and the hyperplane with n-1 dimensions and finds the optimum hyperplane to linearly split data using some kernel functions and the kernel trick utilizing a kernel-based approach to handle non-linear data [29], [31]. SMOreg is an algorithm for optimization. It was Cortes and Vapnik that introduced it middle of the 1990s to improve training data separation and lower prediction error [32]. The Notations of Support Vector Machines are found in Supplementary Table S1
A non-linear mapping function ϕ(X) is used to convert the input data set x into a high dimensional feature space. To perform linear regression on the feature space, a linear model similar to that shown in equation (5) is constructed.
$$g(X,W) = \sum_{K=1}^{M} W_K \varphi_K + b \tag{5}$$
Where WK are the model's hyperparameters, b is the bias. ϕK transforms the incoming data in a non-linear way to produce the feature space. The SVM test measure accuracy ϵ is represented in equation (6).
$$L_{\varepsilon}(y, g(x, w)) = \begin{cases} 0, & \text{if } |y - g(x, w)| \le \epsilon \ |y - g(x, w)| - \epsilon, & \text{otherwise} \end{cases}$$ (6)
The constant ϵ is a tolerance variable. The function in equation (7) is referred to as the empirical risk based on the loss function described in equation (6).
$$E{emp}(w) = \frac{1}{m} \sum{k=1}^{m} L_{\varepsilon}(y_k, g(x_k, w))$$ (7)
The following list of Kernel functions were looked through in this study to discover the best one: Radial Basis Function (RBF) kernel, PolyKernel, Normalised PolyKernel and Pearson universal kernel (Puk) as given in equations (8) – (11) respectively below.
$$f(x) = \sum_{i=1}^{n} \alpha_i y_i \exp\left(-\frac{|x - x_i|^2}{2\sigma^2}\right) + b$$ (8)
The linear kernel function, where c is a constant number, is represented by equation (9).
$$k(x, x') = x^t x' \tag{9}$$
The Polynomial Kernel function is shown in Equation (10), where d is the degree of the polynomial, γ is the slope, and τ is a constant term.
$$k(x, x') = (1 + x'x')^d$$ (10)
Gaussian Kernel
$$k(x, x') = \exp\left(-\frac{|x - x'|^2}{2\sigma^2}\right) \quad \text{for } \sigma > 0$$ (11)
Due to its capacity to simulate nonlinear and dynamic issues, the multilayer perceptron, also known as an artificial neural network (ANN), is a popular machine learning technique used machine learning modelling [6,7]. Due to their numerous neurons, non-linear functions, and intricate structures, multilayer perceptron is frequently referred to as "black boxes" because they are difficult to comprehend. They do quite well in traffic prediction thanks to their non-linear capabilities because traffic patterns are challenging for linear classifiers to understand and are constantly changing. Based on the functions of biological neurons, multilayer perceptron or artificial neural networks were created. They are a network of neurons, different layers, and activation functions that are all triggered in response to inputs. The input, hidden, and output layers are the three main layers of an artificial neural network. The hidden and output layers are where the neurons are situated. Supplementary Figure S1 depicts a typical artificial neural network architecture. The learning rate, the number of hidden layers, and the number of nodes are the hyperparameters for the best outcomes.
Real world traffic volume data were obtained from counting station 1471 for this study. The South African National Road Agency Limited (SANRAL) has deployed continuous count stations to collect traffic volumes at different locations on the Durban - Pietermaritzburg highway section of the N3 to achieve intelligent transportation system through their Freeway Management System (FMS). Different traffic data including traffic volume, are measured every 1hour at different counting stations along the N3 freeway. Hourly traffic volume provides more valuable information than annual average daily traffic for micro level operational analysis.
Figure 2: Counting Station on the Durban to Pietermaritzburg N3 Highway Research Area
The South Africa National Roads Agency Limited (SANRAL), through their contract agency Mikros Traffic Monitoring (MTM) Company, provided the traffic data used in this study. These traffic data samples were gathered over a period of 101 days, or three months and eight days, from the 30th of November 2019 to the 10th of March 2020, using the various traffic counting stations on the N3 High North and South headed to Johannesburg from Durban, resulting in a total of 2425 data samples. The inputs features were: date, time, total lane 1, light lane 1, heavy lane 1, total lane 2, light lane 2, heavy lane 2, total lane 3, light lane 3, heavy lane 3, total lane 4, light lane 4, heavy lane 4, total direction 1, light direction 1, heavy direction 1, total direction 2, light direction 2, heavy direction 2, light road, heavy road, average speed lane 1, average speed lane 2, average speed lane 3, average speed lane 4, average speed direction 1, 85th percentile speed direction 1, average speed direction 2, 85th percentile speed direction two and the target variable was: total road (traffic volume). They are in total 31 features as shown in Supplementary Table S2 and categorized in Supplementary Table S3.
Four machine learning techniques were used in the experiments to model and estimate traffic volume. Performance metrics were evaluated, and the machine learning model with the best highest performance score was chosen. Python programming language and other libraries namely, pandas, NumPy, Scikit-learn were utilized to develop the predictive traffic flow models. Python programming language was employed because of its popularity in the machine learning and research community. Also, it has great frameworks and libraries ecosystem. It is equally fast in data processing. The ML algorithms utilized in this study are described as follows in the python environment: KNN: "K-Nearest Neighbor", Decision Trees, Support Vector Regression (SVR) and Multilayer Perceptron (MLP) also known as Artificial Neural Network (ANN). Before the experiment, the dataset underwent preprocessing. In the dataset, there were no missing values. Coefficient of Determinations were determined for each numerical attribute to determine how the features correspond with the target variable.
Journal Pre-proof Exploratory data analysis was performed to investigate and explore the traffic flow pattern and behaviour as shown in Supplementary Figure S2. Before training and modelling with the four machine learning algorithms, the dataset was divided into a train-test data on ratio of 80% to 20% in the percentage split holdout approach. Standardization was applied to the training dataset. GridSearchCV and 10-fold cross-validation together with the holdout method was employed. GridSearch is a method for optimizing a model's hyper-parameters by exhaustive search. Cross-validation is a method for robustly evaluating a model on a dataset. The holdout method is a technique for splitting the dataset, either into training, testing, and validation sets or training and testing sets. The GridSearchCV was selected to be used because it is a comprehensive hyperparameter search method, and it picks the best combination of hyperparameters. Each parameter setting underwent cross-validation. The mean score was then recorded, where the mean is the average throughout the 10-fold cross-validation experiments. The best hyperparameters combination across the 10 splits was chosen following examination, tuning, and performing excellently during training of the model.
The best hyperparameters was then used to build the final model. The model was evaluated using the test set. The performance measures in Equations (12), (13) and (14) were used for the selection of the best performing model for traffic volume modelling and prediction following the evaluation.
The performance of machine learning algorithms depends on the search and selection of the optimal hyperparameters optimum value combinations that produce the most outstanding performance of the classifier. The importance of hyperparameters optimization in machine-learning cannot be overemphasized. Hyperparameter optimization improves machine learning performance by enhancing system efficiency and accuracy, minimizing needless human intervention, and maintaining repeatability and fairness in research. It facilitates equitable comparisons, as all machine learning algorithms undergo identical hyperparameter tweaking for the specified task.
In this experiment, the GridSearchCV search method was used to determine the ideal hyperparameters that give the maximum coefficient of determination (R²). The optimization technique using GridSearchCV was carried out with 10-fold cross validation on the training set. The selected ideal hyperparameters for each model are displayed in Table 1. The hyperparameters searched for the KNN were the n neighbors, weights, and the distance metric. The
n-neighbors values looked for were (8, 9, 10, 12, 13). The metrics included (Minkowski, Euclidean, and Manhattan). The weights were: uniform and distance.
Table 1: Algorithms Hyperparameters considered and ultimate best parameters for the presented models.
| Algorithm | Hyperparameter | Range considered | f Optimal value |
|---|---|---|---|
| KNN | nneighbors | 8, 9, 10, 12, 13 | 8 |
| Distance metric | Minkowski, Euclidean, Manhattan | Minkowski | |
| Weights | uniform, distance | o distance |
|
| Decision Tree | max_depth | o 8, 9, 10, 11, 13 |
11 |
| criterion | squared_error, friedman_mse, absolute_error | absolute_error | |
| max_features | auto, log2, sqrt | auto | |
| min_samples_leaf | 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 | 1 | |
| max_leaf_nodes | r 10, 20, 30, 50, 70, 80, 90 |
90 | |
| Penalty parameter C | p 1 to 30 |
18 | |
| SVR | Kernel | linear, poly, rbf, sigmoid | linear |
| ϵ | 0.01, 0.1, 1 | 0.01 | |
| Hidden layer size | - 3, 10, 20 |
20 | |
| Learning rate schedule | e constant, adaptive, invscaling |
invscaling | |
| MLP | Activation | identity, logistic, tanh, relu | identity |
| Solver | adam, sgd, lbfgs | lbfgs | |
| the highest Coefficient of Determination. The upper range was picked from 8-13. |
r P As shown in Supplementary Figure S3, the initial range of 1- 20 was used to determine the best range that produces Similarly, the hyperparameters searched for the decision tree models were the maximum Depth (maxDepth), criterion, max_ f eatures, minsample_lea f and max_lea f _nodes. The initial range of (1- 20) was used to identify the best maxDepth range that produces the highest coefficient of determinationas |
||
| l shown in Supplementary Figure S4. The maxDepth 8, 9, 10, 11, 13 were selected. Cost, kernel, and epsilon were the searched hyperparameters for the SVR. The values included in the cost were (1 to 30). Additionally, the list of kernel a types contained (PolyKernel, linear, sigmoid and RBF Kernel) while the epsilon (0.01, 0.1, 1). Learning, activation, solver, and hidden layers sizes were the Multi-Layer Perceptron hyperparameters examined. The values considered in the number of hidden layers were (3,10, 20), the list of learning rate were constant, adaptive and invscaling. The activation list were ( identity, logistic, tanh, relu) and the list for solver were (adam, sgd, lbfgs). |
|||
| 4.4. Performance Measures prediction mistakes. |
r error (MAE), the Coefficient of determination(R |
n To assess the effectiveness of the performance, three performance measures were used. They are the mean absolute 2 ), and the root means square error (RMSE), which measures how well observed the model repeats results, is the percentage of traffic volume variance that forecast. The MAE, which measures the discrepancy between actual and projected values, provides a clear explanation of the average size of |
|
| u o 2 = R J |
− ¯yˆi) Pn (yi − y¯)(ˆyi i=1 qPn pPn − ¯yˆi) 2 2 (yi − y¯) (ˆyi i=1 i=1 |
(12) |
$$R^{2} = \frac{\sum{i=1}^{n} (y{i} - \bar{y})(\hat{y}{i} - \bar{\hat{y}}{i})}{\sqrt{\sum{i=1}^{n} (y{i} - \bar{y})^{2}} \sqrt{\sum{i=1}^{n} (\hat{y}{i} - \bar{\hat{y}}_{i})^{2}}}$$ (12)
$$RMSE = \left[\frac{1}{n} \sum_{i=0}^{n-1} (y_i - \hat{y}_i)^2\right]^{\frac{1}{2}}$$ (13)
Mean Absolute Error (MAE) = $$\frac{1}{n} \sum_{i=0}^{n-1} |y_i - \hat{y}_i|$$ (14)
The primary statistical analysis methods were used to analyze the dataset attributes. Before analyzing the dataset, SiteID, and Duration attributes (a constant difference of 1hr between data samples) were removed. The mean, median, standard deviation, maximum, and minimum values of the numerical attributes were calculated and recorded in Supplementary Table S4. Furthermore, the coefficient of determination between each feature and the target variable was computed. The values were ranked in descending order, as shown in Supplementary Table S5.
For lane and stream enumeration, this study adopts SANRAL's 2018 Standard Traffic Data Collection Format. Supplementary Figure S5 showing examples of stream and lane numbers for two-way road links. Each road segment is divided into two traffic flows: Stream1 (Northward or Eastward), Stream2 (Southbound or Westbound). Lanes are numbered in order from left to right in each stream: Lane 1 is the far left lane and can be the median or shoulder lane depending on the road. If available, lane 4 is the rightmost lane. Directional totals (ex: Total Direction 1) aggregate all lanes in a stream. This approach ensures consistency and allows for a simple comparison of lane-based traffic with directional traffic.
Journal Pre-proof The exploratory data analysis result is presented in this section. Supplementary Figure S6 - Supplementary Figure S9 presents the scatter plots of average speed and traffic volume in lane 1, 2, 3 and 4. We can see that lane 2 experiences the least average while lane 4 has the highest average speed reaching up to 140km/hr. Lane 1 experiences the second least speed then lane 3 the second average speed. Also, the likelihood of vehicles getting stuck or stopping takes place on lane 1.Supplementary Figure S10 and Supplementary Figure S11 shows the average speed distribution by directions of the highway direction 1(Northbound) and direction 2 (Southbound). We can see that Northbound, the speed ranges from 60km/hr to 90km/hr with 80km/hr been the most frequent speed whereas Southbound, the average speed ranges from 65km/hr to 115km/hr with most frequent speed been 100km/hr. Also, there are stationary vehicles in the Northbound direction compared to the Southbound direction with no stationary vehicles.Supplementary Figure S12 and Supplementary Figure S13 presents the traffic flow distribution density and boxplot. Supplementary Figure S14 depicts the hourly traffic volume behaviour. We can see that the highest traffic flow is experienced at 10 am and 5pm. The traffic flow starts to increase from 5am in the morning and decrease by 7pm. In Supplementary Figure S15 , the traffic flow distribution by days of the week is depicted. Fridays, Mondays, and Thursdays have the most traffic flow in the week. Sundays have the least traffic flow on the highway.
Presented below are the results descriptions of the various experiments performed utilizing the four classifiers: K-Nearest Neighbours (KNN), Decision Tree, Support Vector Regression (SVR) and Multi-Layer Perceptron (MLP) also known as Artificial Neural Networks (ANN) and the entire set of features. The results of the experiments conducted in this work are presented in this section. Python programming language was utilized in this experiment to develop the traffic predictive models using Jupyter Notebook. Version 3.9.12 of Python and Jupyter Notebook 6.4.8 were used to implement the model on a computer with an x64 intel-based processor, a 64-bit operating system, and an 11th Generation Intel(R) Core i7-11850H processor @ 2.50 GHz cores up to 4.8 GHz, 24 MB L3 cache, 8cores, 16 threads. It has a 512 GB M.2 NVMe TLC SSD drive, NVIDIA RTX A2000 4GB GDDR6 Graphics, and 32.0 GB DDR4 3200MHz of RAM. Experiments were carried out using the GridSearchCV together with the 10-fold Cross-validation after the dataset was split using the (80:20)% percentage split holdout method. The results of the experiments are presented in Table 2. Supplementary Table S6 also shows some of the results of the experiments for the time taken to fit and score the model according to the machine learning Scikit-learn and python platform. The hyperparameters tuning carried out is detailed in section 5.3.
For optimal performance of the selected classifiers and fairness to every algorithm, hyperparameters tuning of the classifiers were carried out using 10-fold cross-validation and the GridSearchCV for the tuning of the hyperparameters in decision tree, KNN, SVR and for the ANN classifiers. The Support Vector Regression (SVR) performed best overall with a Coefficient of determination of 99.5192%, RMSE: 36.2543, MAE: 36.1075 closely edging out the ANN (MLP) with a Coefficient of determination 99.5189%, RMSE: 36.2638, MAE: 36.1061, followed by Decision Tree with a Coefficient of determination: 99.4451%, RMSE: 37.8791, MAE: 36.0598, then K-Nearest Neighbour (KNN) with a Coefficient of determination: 99.0532%, RMSE: 50.8742, MAE: 37.7463.
Table 2: Hyperparameter optimisation results for the benchmarked models.
| o SVR MLP (ANN) r 99.5192 99.5189 36.2543 36.2638 p 36.1075 36.1061 Each of the scatterplots in Figure 3 compares the actual traffic volumes to those predicted by the different models. |
Decision Tree 99.4451 37.8791 36.0598 - e r P |
KNN 99.0532 50.8742 37.7463 |
Coefficient of Determination (R²) (%) |
|---|---|---|---|
| l | |||
| a | |||
| n r |
|||
Each of the scatterplots in Figure 3 compares the actual traffic volumes to those predicted by the different models.
Figure 3: Scatter plots of modelling techniques.
It is evident that the prediction results by SVR and ANN classifiers demonstrated a more accurate modelling of the predicted traffic volumes to the actual traffic volume indicating good predictive outcomes from the models. However, the SVR outperformed the ANN classifiers on the coefficient of determination and the RMSE as shown in Table 2.
Table 3 provides a comparison of the various techniques based on their Coefficient of Determination (R²), with the SVR-ML technique used in this study achieving the highest R² value of 0.9952, surpassing all others. This indicates superior predictive accuracy compared to models such as Hybrid ANN-PSO (R² = 0.9672) and T-LGGCN (R² = 0.9489). The significantly higher R² value demonstrates that the Support Vector Regressor model of the Machine Learning Techniques (SVR-ML) in this study fits the data more effectively, providing a more accurate and reliable prediction than the other techniques listed.
Table 3: Comparison of the present study with selected existing studies.
| Study | Techniques | 2 Coefficient of Determination (R ) |
|---|---|---|
| [32] | Hybrid ANN-PSO | 0.9672 |
| [33] | ANN | 0.9261 |
| [22] | KNN | 0.9390 |
| [23] | T-LGGCN | 0.9489 |
| [24] | LSTM-BiLSTM | 0.8600 |
| [25] | Autoencoder Bi-LSTM | 0.9345 |
| [26] | Conv-BiLSTM | 0.9500 |
| [27] | ST-PEF+ | 0.8830 |
| This work | SVR-ML | 0.9952 |
Journal Pre-proof Thisstudy developed and evaluated machine-learning modelsfor hourly traffic-volume prediction on South Africa's N3 national motorway using real-world continuous count-station data. Among the four benchmarked methods, SVR delivered the best predictive performance (R² = 0.9952; RMSE = 36.25; MAE = 36.11), with MLP performing comparably, while Decision Tree and KNN produced slightly higher errors. The main contribution is a reproducible benchmarking framework and empirical model ranking for hourly freeway forecasting in an underrepresented African context, providing actionable guidance for transport stakeholders seeking accurate, computationally efficient prediction tools. Practically, the results can support proactive traffic management, corridor operations planning, and performance monitoring on strategic freight and commuter routes. This work is limited by its reliance on a single corridor and period of observation, and it does not explicitly model exogenous factors such as incidents, weather, or seasonal disruptions. Future research should validate the framework across additional sites and longer time spans, incorporate external explanatory variables, and assess feature-reduction strategies to maintain accuracy while reducing sensing and operational costs.
The South Africa National Roads Agency Limited (SANRAL) and their contract agency Mikros Traffic Monitoring (MTM) for providing the traffic data used in this research.
[3] Ko´zlak, A.; Wach, D. Causes of Traffic Congestion in Urban Areas. Case of Poland. SHS Web Conf. 2018, 57, 01019, doi:10.1051/shsconf/20185701019.
[4] Ghazali, W.N.W.B.W. The Effect of Traffic Congestion on Quality of Community Life. 2019, 759–766, doi:10.15405/epms.2019.12.77.
[5] Bull, A. Traffic Congestion The Problem and How to Deal with It? 2004; ISBN 92-1-121432-7.
[6] Das, D.K.; Keetse, M.S.M. Assessment of Traffic Congestion in the Central Areas of Kimberley City. Interim Interdiscip. J. 2015, 14, 70–82.
[7] Zhang, K.; Nie, Y. (Marco). Mitigating Traffic Congestion Induced by Transportation Network Companies: A Policy Analysis. Transp. Res. Part A Policy Pract. 2022, 159, 96–118, doi:10.1016/j.tra.2022.01.017.
[8] Rehman, A.; Rathore, M.M.; Paul, A.; Saeed, F.; Ahmad, R.W. Vehicular Traffic Optimisation and Even Distribution Using Ant Colony in Smart City Environment. IET Intell. Transp. Syst. 2018, 12, 594–601, doi:10.1049/iet-its.2017.0308.
[9] Becker, F.G.; Cleary, M.; Holtermann, H.; et al. Guide to Traffic Management Part 3: Traffic Studies and Analysis. 2015; Vol. 7; ISBN 9772081415.
[10] Abduljabbar, R.; Dia, H.; Liyanage, S.; Bagloee, S.A. Applications of Artificial Intelligence in Transport: An Overview. Sustain. 2019, 11, doi:10.3390/su11010189.
[11] Sarker, I.H. Machine Learning: Algorithms, Real-World Applications and Research Directions. 2021, 2, 160, doi:10.1007/s42979-021-00592-x.
[12] Akhtar, M.; Moridpour, S. A Review of Traffic Congestion Prediction Using Artificial Intelligence. J. Adv. Transp. 2021, 2021, 18, doi:10.1155/2021/8878011.
[13] Shamshad, N.; Sarwr, D. A Review of Traffic Flow Prediction Based on Machine Learning Approaches. Int. J. Sci. Eng. Res. 2020, 11, 126–130.
[14] Miglani, A.; Kumar, N. Deep Learning Models for Traffic Flow Prediction in Autonomous Vehicles: A Review, Solutions, and Challenges. Veh. Commun. 2019, 1, 100184, doi:10.1016/j.vehcom.2019.100184.
[15] Sun, S.; Chen, J.; Sun, J. Traffic Congestion Prediction Based on GPS Trajectory Data. Int. J. Distrib. Sens. Networks 2019, 15.
[16] Reshma Ramchandra, N.; Rajabhushanam, C. Machine Learning Algorithms Performance Evaluation in Traffic Flow Prediction. Mater. Today Proc. 2021, 1–5, doi:10.1016/j.matpr.2021.07.087.
[17] Liu, J.; Wang, X.; Li, Y.; Kang, X.; Gao, L. Method of Evaluating and Predicting Traffic State of Highway Network Based on Deep Learning. 2021, doi:10.1155/2021/8878494.
Journal Pre-proof [18] Artin, J.; Valizadeh, A.; Ahmadi, M.; Kumar, S.A.P.; Sharifi, A. Presentation of a Novel Method for Prediction of Traffic with Climate Condition Based on Ensemble Learning of Neural Architecture Search (NAS) and Linear Regression. Complexity 2021, 2021, doi:10.1155/2021/8500572.
[19] Sun, P.; Aljeri, N.; Boukerche, A. Machine Learning-Based Models for Real-Time Traffic Flow Prediction in Vehicular Networks. IEEE Netw. 2020, 34, 178–185, doi:10.1109/MNET.011.1900338.
[20] Kumar, K.; Parida, M.; Katiyar, V.K. Short Term Traffic Flow Prediction for a Non Urban Highway Using Artificial Neural Network. Procedia - Soc. Behav. Sci. 2013, 104, 755–764, doi:10.1016/j.sbspro.2013.11.170.
[21] Raj, J.; Bahuleyan, H.; Devi, L. Application of Data Mining Techniques for Traffic Density Estimation and Prediction. Transp. Res. Procedia 2016, 17, 321–330, doi:10.1016/j.trpro.2016.11.102.
[22] Mladenovic, D.; Jankovi ´ c, S.; Zdravkovi ´ c, S.; Mladenovi ´ c, S.; Uzelac, A. Night Tra ´ ffic Flow Prediction Using K-Nearest Neighbors Algorithm. Oper. Res. Eng. Sci. Theory Appl. 2022, 5, 152–168, doi:10.31181/oresta240322136m.
[23] Feng, S.; Huang, J.; Shen, Q.; Shi, Q.; Shi, Z. A Hybrid Model Integrating Local and Global Spatial Correlation for Traffic Prediction. IEEE Access 2022, 10, 2170–2181, doi:10.1109/ACCESS.2021.3139934.
[24] Ma, C.; Dai, G.; Zhou, J. Short-Term Traffic Flow Prediction for Urban Road Sections Based on Time Series Analysis and LSTM-BILSTM Method. IEEE Trans. Intell. Transp. Syst. 2022, 23, 5615–5624, doi:10.1109/TITS.2021.3055258.
[25] Essien, A.; Petrounias, I.; Sampaio, P.; Sampaio, S. A Deep-Learning Model for Urban Traffic Flow Prediction with Traffic Events Mined from Twitter. World Wide Web 2021, 24, 1345–1368, doi:10.1007/s11280-020-00800-3.
[26] Bilotta, S.; Collini, E.; Nesi, P.; Pantaleo, G. Short-Term Prediction of City Traffic Flow via Convolutional Deep Learning. IEEE Access 2022, 10, 113086–113099, doi:10.1109/ACCESS.2022.3217240.
[27] Wang, J.; Ji, J.; Jiang, Z.; Sun, L. Traffic Flow Prediction Based on Spatiotemporal Potential Energy Fields. IEEE Trans. Knowl. Data Eng. 2023, 35, 9073–9087, doi:10.1109/TKDE.2022.3221183.
[28] Nguyen, D.B.; Dow, C.R.; Hwang, S.F. An Efficient Traffic Congestion Monitoring System on Internet of Vehicles. Wirel. Commun. Mob. Comput. 2018, 2018, doi:10.1155/2018/9136813.
[29] Bokaba, T.; Doorsamy, W.; Paul, B.S. Comparative Study of Machine Learning Classifiers for Modelling Road Traffic Accidents. Appl. Sci. 2022, 12, 828, doi:10.3390/app12020828.
[30] Li, Y.; Liu, G.; Cheng, Y.; Wu, J.; Xiong, Y.; Ma, R.; Wang, Y. Application of Artificial Intelligence Technology in Traffic Flow Forecast. J. Phys. Conf. Ser. 2021, 1852, doi:10.1088/1742-6596/1852/2/022076.
[31] Wang, W.X.; Guo, R.J.; Yu, J. Research on Road Traffic Congestion Index Based on Comprehensive Parameters: Taking Dalian City as an Example. Adv. Mech. Eng. 2018, 10, 1–8, doi:10.1177/1687814018781482.
[32] Olayode, I.O.; Tartibu, L.K.; Okwu, M.O.; Severino, A. Comparative Traffic Flow Prediction of a Heuristic ANN Model and a Hybrid ANN-PSO Model in the Traffic Flow Modelling of Vehicles at a Four-Way Signalized Road Intersection. Sustain. 2021, 13, doi:10.3390/su131910704.
Journal Pre-proof [33] Olayode, I.O.; Tartibu, L.K.; Okwu, M.O. Prediction and Modeling of Traffic Flow of Human-Driven Vehicles at a Signalized Road Intersection Using Artificial Neural Network Model: A South African Road Transportation System Scenario. Transp. Eng. 2021, 6, 100095, doi:10.1016/j.treng.2021.100095.
[34] Makaba Tebogo, G.B. The Design of a Vehicle Traffic Flow Prediction Model for a Gauteng Freeway Based on an Ensemble of Multi-Layer Perceptron. Int. J. Comput. Inf. Eng. 2016, 10, 111–117.
[35] Nkosi, Z.P. The Design of a Vehicle Traffic Congestion Bayesian Prediction Model for Gauteng. University of Johannesburg (South Africa), 2015.
[36] Department of Transport, R. of S.A. A Draft Intelligent Transport Systems Policy for South Africa.
[37] Statistics South Africa. Mid-Year Population Estimates 2021; Johannesburg, 2021.
[38] Stats SA. Department of Statistics, R. of S.A. 2020 Mid-Year Population Estimates_Statistics South Africa.
[39] Niekerk, A. Van; Bester, G. Freeway Management System (FMS): I-Transport Conference Focus on IMS and On Road Services. 2013.
[40] Parrock, P. Mega Project Analysis: A Case Study of the Gauteng Freeway Improvement Project. Stellenbosch Univ. 2015, 128.
Author Contributions:
Journal Pre-proof Christian Chuks Emenike: Conceptualization, Data Curation, Formal Analysis, Methodology, Experiments, writing—review.
Ernest Bhero, and Bhekisipho Twala: editing, Result Validation, Project Administration, Supervision, Review and Critical Revision.
| Declaration of interests |
|---|
| The authors declare that they have no known competing financial interests or personal relationships f ☐ that could have appeared to influence the work reported in this paper. |
| o The author Bhekisipho Twala is an associate editor of the Information Sciences Journal, Intelligent ☐ Data Analysis Journal, Journal of Computers, International Journal of Advanced Information Science and Technology, International Journal of Big Data Intelligence, Journal of Image and Data Fusion, Journal of o Information Processing Systems and was not involved in the editorial review or the decision to publish this article. |
| The authors declare no conflicts of interest. ☐ |
| r p - e r P l a n r |
| u o J |