Ensemble Learning-based Algorithms for Traffic Flow Prediction in Smart Traffic Systems

Due to the tremendous growth of road traffic accidents


INTRODUCTION
Road traffic accidents are dramatically augmented each year due to the massive increasing number of vehicles on the roads.This problem is considered a serious risk, a major source of trouble for individuals worldwide, and a significant global concern.[1].Collecting and analyzing comprehensive data is essential for any initiative aiming to improve traffic safety [2].With the rising number of vehicles on the roads and the resulting congestion issues, optimizing traffic flow has become a pressing challenge in modern cities.Intelligent Transportation Systems (ITSs) have emerged as a promising solution to alleviate traffic congestion and enhance overall transportation efficiency [3][4].The Vehicle Ad-Hoc Network (VANET) serves as a fundamental infrastructure for ITSs, enabling wireless connectivity among vehicles [5][6].Additionally, intelligent transport systems are increasingly focused on addressing traffic congestion.Researchers have employed machine learning algorithms to predict traffic flow and reduce congestion at intersections.These models were evaluated using

www.etasr.com Alkarim et al.: Ensemble Learning-based Algorithms for Traffic Flow Prediction in Smart Traffic Systems
the national road traffic dataset for the UK.An adaptive traffic light system was implemented, which adjusts green and red lights based on road width, traffic density, and vehicle categories.Simulations demonstrated a 30.8% decrease in traffic congestion [7].
Accurate traffic prediction is crucial for ameliorating the effectiveness of traffic systems and reducing energy consumption.Machine learning-based methods have become commonplace, but they often rely on historical data [8][9].Furthermore, ML-based models are gaining popularity due to their ability to accurately forecast traffic conditions, thereby improving safety and infotainment applications.However, the efficacy of these models in predicting real-time traffic remains a subject of investigation [10].
Several research studies have focused on developing methods and models for traffic flow prediction and management.In [11], a framework is presented that utilizes Vector Auto Regression (VAR) and a CNN-LSTM hybrid neural network to predict short-term traffic flow.The CNN-LSTM model outperforms other models in forecasting shortterm traffic flow and demonstrates predictive accuracy associated with spatial correlation in traffic flow.In [12], three proposed solutions are discussed to address the issue of missing data in traffic management.These solutions include a livetraffic simulation, a neural network traffic prediction and rerouting system based on pheromone principles, as well as a Weighted Missing Data Imputation (WEMDI) approach.The integration of WEMDI into the systems yields notable improvements in various traffic factors and demonstrates efficient routing to alternative destinations.ML and neural networks play a significant role in solving traffic congestion issues.In this context, authors in [13] propose ML and DL algorithms for predicting intersection traffic flow.The models were trained, validated, and tested using public datasets, and the Multilayer Perceptron Neural Network (MLP-NN) produced the best results.Gradient Boosting, Recurrent Neural Networks, RF, LR, and Stochastic also showed promising performance.
ITSs require traffic flow monitoring for effective management and optimization.Conventional methods of data collection and analysis are being augmented with AI techniques, such as ensemble learning [14].The IAROEL-TFMS methodology utilizes feature subset selection and optimal ensemble learning to predict traffic flow, outperforming other approaches with its low RMSE.Authors in [14] used Hybrid-LSSVM, AST2FP-OHDBN, and IAROEL-TFMS models for evaluation purposes, considering their respective performance indicators.Among the several models evaluated, it was observed that IAROEL-TFMS had the most superior predictive performance.In close succession, the AST2FP-OHDBN model exhibited robust performance, whereas, in contrast, the Hybrid-LSSVM model demonstrated a somewhat reduced level of prediction accuracy.Regarding predictive performance, the IAROEL-TFMS model had the best precision and accuracy in forecasting the target variable.The AST2FP-OHDBN model closely followed it.On the other hand, the Hybrid-LSSVM model exhibited slightly inferior predictive skills.This paper utilizes four Machine Learning (ML) and Deep Learning (DL) models: Random Forest (RF), Linear Regression (LR), Long Short-Term Memory (LSTM), and ensemble bagging (RF).The objective is to utilize these predictions to enhance the efficiency of traffic light controllers in the context of traffic flow prediction at intersections.Experimental results demonstrate that all models exhibit a strong predictive capacity for estimating vehicular flow, highlighting their potential utility in smart traffic systems.

II. THE PROPOSED MODEL
This study has developed a model for monitoring traffic flow.The primary objective of this model is to predict traffic movement.To achieve this objective, the model operates in three distinct stages.Firstly, data collection can be accomplished using cameras or sensors.Secondly, ML and DL technologies are applied.Thirdly, the outcomes are evaluated using MAE, RMSE, and the coefficient of determination (Rsquared).The workflow of the suggested approach is illustrated in Figure 1.Overall, the proposed model aims to monitor traffic flow by predicting its movement.It involves data collection through cameras or sensors, the application of machine learning and deep learning technologies, and the evaluation of outcomes using specific error metrics.Figure 1 provides a visual representation of the workflow.The workflow of the proposed model.

A. Data Collection
The dataset used for traffic prediction was obtained from various traffic sensors provided by the Huawei Munich Research Center.The dataset plays a crucial role in predicting traffic patterns and making necessary adjustments to stop-light control settings, including cycle length, offset, and split timings.The dataset consists of recorded data from six intersections located within an urban area, collected over a period of 56 days (Table I).The data are presented as a flow time series, which indicates the number of vehicles passing through each intersection every 5 minutes, spanning 24 hours.This results in 12 readings per hour, 288 readings per day, and a total of 16,128 readings over the course of the 56 days.For this study, 4 out of the 6 intersections were selected to replicate a 4-lane intersection scenario [15].

B. Data Preparation
Data cleaning is a critical step in the preprocessing phase, where incorrect, incomplete, duplicate, or erroneous data within a dataset are rectified.Fortunately, the collected data for this study do not contain any missing values.The dataset has been divided into two parts: 70% for training the model and the remaining portion for testing.To ensure consistency and optimal performance during training, the data were scaled using the MinMaxScaler from the scikit-learn library.This scaler transforms the data, making them range between zero and one [16].

C. Proposed Techniques
In this study, four regression models from the scikit-learn module in the Python programming language are employed.The scikit-learn module is a comprehensive Python library that offers a wide range of state-of-the-art machine learning algorithms designed to tackle various supervised and challenges [16].The authors applied four ML/DL techniques to the dataset: RF, LSTM, LR, and ensemble method (bagging).The following section provides an overview of the traditional ML and ensemble methods utilized in the experiment.

III. OVERVIEW OF TRADITIONAL MACHINE LEARNING AND ENSEMBLE METHODS
A. Random Forest RF is a learning method that combines multiple tree predictors.Each tree in the forest is constructed based on the values of a random vector, sampled independently from the same distribution for all trees.Tree-based models form the core components of the random forest algorithm.A tree-based model involves iteratively dividing a given dataset into two distinct groups, guided by a specific criterion, until a predetermined stopping condition is met.The terminal nodes of decision trees are commonly known as leaf nodes or leaves [17].

B. Long Short-Term Memory (LSTM)
LSTM networks have found extensive applications in various domains, including image processing, speech recognition, manufacturing, autonomous systems, communication, and energy consumption, for dynamic system modelling purposes.LSTM has gained significant attention in recent years due to its effectiveness in modeling and predicting the dynamics of nonlinear time-variant systems.It incorporates the characteristics of short-term and long-term memory, the ability to make predictions several steps ahead, and the propagation of errors.Sequence-to-sequence networks with partial conditioning have been shown to outperform other techniques such as bidirectional or associative networks, making them well-suited for achieving the specified objectives [18].

C. Linear Regression
LR is a widely used and straightforward ML algorithm.The technique is a mathematical methodology employed to do predictive analysis.Moreover, LR is a statistical technique that enables the prediction of continuous or numerical variables.LR is a statistical technique employed to assess and quantify the association between variables under consideration [19].

D. Ensemble Method (Bagging)
Bagging, short for bootstrap aggregating, is a technique that involves creating multiple iterations of a predictor and combining them to form an aggregated predictor.In the aggregation process, the mean is calculated across the iterations when predicting a numerical outcome, while a majority vote is used when predicting a class.To generate multiple versions, bootstrap copies of the original learning set are created, and these replicates are then used as new learning sets [20].

IV. EVALUATION MEASURES
In model evaluation, the coefficient of determination (Rsquared), RMSE, and MAE are standard metrics [21].

V. EXPERIMENTAL RESULTS AND DISCUSSION
Table II presents the results of the model using various ML and DL algorithms.It can be observed that RF achieved an MAE of 13.76, while LSTM and LR achieved 14.74 and 17.80, respectively.When Bagging (RF) was applied, the minimum MAE obtained was 13.69.In terms of RMSE, the models achieved values of 22.39, 23.50, and 27.04, while the Bagging model achieved a lower RMSE of 22.21.In terms of R 2 , the experimental results for the models were 0.9341, 0.9275, and 0.9040, respectively.The best R 2 value was obtained by the Bagging model, which achieved a value of 0.9352.The results show that the RF model and the Bagging model (using RF as the base model) outperformed the LSTM and LR models in terms of both MAE and RMSE.Additionally, the Bagging model showed the highest R 2 value, suggesting a better fit to the data.Overall, these findings demonstrate the effectiveness of the RF algorithm and the potential benefits of using ensemble methods like Bagging for traffic flow prediction.Figure 2 illustrates the numerical values of MAE measurements of the considered models.It can be observed that the LSTM model has a slightly higher MAE (14.74) compared to the RF (13.76) and Bagging (RF) (13.69) models.This suggests that the LSTM model may not perform optimally in this particular scenario.On the other hand, the LR model has the highest MAE score (17.80).This indicates that it may not excel at accurately predicting the target variable.These results suggest that the RF and Bagging models (using RF as base) perform better than the LSTM and LR models in terms of MAE.It is important to consider these findings when selecting the most suitable model for traffic prediction in this context.The figures presented in Figure 3 illustrate the RMSE values of the considered models.It can be observed that the Bagging (RF) model has the lowest RMSE score (22.21), indicating that, on average, its predicted values deviate the least from the actual values.This suggests that the model exhibits strong predictive accuracy.The RF model also performs well, although it has a slightly higher RMSE (22.39) compared to the Bagging model.On the other hand, the LSTM model shows a larger RMSE (23.50), indicating potentially inferior performance in terms of predictive accuracy.The LR model has the largest RMSE value (27.04), suggesting a potentially lower level of accuracy in predicting the target variable.These findings again suggest that both the Bagging (RF) and RF models perform well in terms of RMSE, indicating their ability to provide accurate predictions.However, the LSTM and LR models may have limitations in accurately predicting the target variable based on their higher RMSE values.
Figure 4 shows the R 2 values of the considered models.R 2 ranges from 0 to 1, with a value of 1 indicating a perfect fit.Among the models presented, it is evident that the Bagging (RF) model shows the highest R 2 value (0.9352), designating its superior ability to fit the data accurately.The RF (0.9341) and LSTM (0.9275) models also demonstrate high R 2 values, suggesting their effectiveness in explaining a significant proportion of the observed variability in the dependent variable, while LR performs satisfactorily (0.9040), its R 2 value is slightly lower compared to the alternative models.Overall, it can be noticed that all of the models exhibit strong performance in elucidating the variability in the dependent variable.However, it is noteworthy that Bagging (RF) emerges as the most prominent performer among them.Compared to [13], this research has improved the results by more than 0.5%.In [13], the researchers used the same dataset and applied 5 ML methods.Gradient boosting was the most succesful, with 93.05%.The proposed model gets 93.41% by utilizing an RF model.Bagging (RF) has the highest result of 93.52%.In the future, researchers in this field could use a combination of ML and DL models to improve model performance [22].

VI. CONCLUSION
In this article, we mainly presented a new model to enhance intelligent traffic systems.The main purpose of this method is to recognize the traffic flow prediction or vehicle movement at intersections applying an ensemble learning technique.The proposed framework consisted of three primary phases: data collection through cameras and sensors, implementation of

Fig. 1 .
Fig. 1.The workflow of the proposed model.