TRAFFIC PREDICTION USING MACHINE LEARNING
Veera Chaitanya1,K Ajay Mavullu2, Achanta Gopi3 ,Ganga Bhavani Billa4
1,2,3
Department of Computer Science (Artifical Intelligence And DataScience) in Bonam Venkata Chalamayya Collage,odelarevu,India.
4
Department of Computer Scienc and Machine Learning in Bonam Venkata Chalamayya Collage,odelarevu,India.
Abstract
data, machine learning (ML)-based traffic management systems can
Although we would like to, we don't respect traffic laws improve decision-making refers to the fig -1.
and regulations. When others do that, it's a mistake; when we do it,
it's referred to as stress and common sense. The goal of this study
is to determine people's self-rated level of awareness about traffic
laws and errors. This includes attitudes, beliefs, and perceptions
about driving safety as well as variables that affect how they
interact with concerns like traffic laws, reckless driving, driving in
the wrong direction, using a phone, playing loud music, speeding,
blocking free-way and one-way roads, etc.Therefore, the purpose
of this survey is to raise awareness of traffic rules by discussing
concerns pertaining to them. In the present era, road traffic
accidents (RTAs) are on the rise and will continue to do so as the
number of vehicles on the road rises along with the number of
aggressive road users. The majority of RTAs result from a failure
to follow traffic laws. Drivers in rural areas participated in a
descriptive cross-sectional research. A basic random approach was
used to include 207 people in total.Information was gathered
through in-person interviews.Questions like the minimum distance Fig-1 . AI and ML based integrated traffic management system
between two cars and the maximum amount of blood alcohol that
can be consumed while driving were more likely to cause
ignorance. The majority of drivers engaged in unsafe driving . In order to improve overall traffic efficiency, Deshmukh et al. [1]
behaviors, such as using a cell phone while operating a motor presented an intelligent traffic signal system that uses machine
vehicle, speeding excessively, and drinking while driving. learning algorithms to dynamically optimize signal timing. Similar to
this, Meena et al. [2] used machine learning approaches to improve
Keywords: Traffic prediction, Machine learning, Deep the predicted accuracy of their traffic prediction models for
learning, Artificial intelligence (AI), Predictive modelling, intelligent transportation systems. These developments help create
Data-driven forecasting more efficient traffic control systems, which lessen traffic and
increase mobility.The work of Navaas Roshan et al. [3], who
presented an adaptive traffic control system utilizing TinyML for
1. INTRODUCTION real-time traffic optimization, is another noteworthy addition in this
Nowadays, traffic is the main issue everywhere. The area. Zhang et al. [5] studied environmentally adaptive intelligent
growing population, rising living standards, and hectic lifestyles traffic signal management systems, whereas Jain et al. [4] created a
have forced many to own or rent cars, which has contributed to an machine learning-based real-time traffic control system to promote
increase in pollution and unintentional fatalities. There are several more seamless urban transportation. These methods optimize traffic
routes to commute, which is one of the main causes of the growing signals and cut down on vehicle delays by using data-driven
traffic issues. The many forms of transportation include vehicles, decision-making. Yang et al. [6] investigated intelligent cooperation
buses, two-wheelers, and autos, among others. We are only a control for urban traffic networks, focusing on coordinated traffic
phone call away from all of these, and even at midnight, cabs and flow management, going beyond traffic signal optimization. Deep
cars are available. We all utilize some form of transportation, and a reinforcement learning was used by Luo et al. [7] to increase the
large percentage of college students and office workers rely on effectiveness of traffic light regulation. In the meantime, C et al. [8]
buses, metros, and cars to get to their destinations on time. This shown the possibility of combining smart sensors with machine
essay aids us in determine the proportion of them who actually learning-based traffic management techniques by proposing an IoT-
understand and abide by the driving laws. Traffic congestion and enabled traffic queue managing system. In order to overcome the
road safety have become major concerns in modern urban scalability issues in urban traffic management, Dai et al. [9]
environments due to the rapid increase in vehicular density. investigated hierarchical intelligent control systems. In their study on
Efficient traffic management is essential to minimize delays, intelligent vehicle networking and traffic accident management, Radi
optimize resource utilization, and enhance commuter safety. et al. [10] offered insights into how artificial intelligence (AI) might
Traditional traffic control mechanisms, such as fixed-time traffic improve emergency response systems. In addition, V. G. et al. [11]
signals, often fail to adapt to dynamic road conditions, leading to presented a smart traffic management system that uses cameras, RF
inefficiencies and increased accident risks. In response, intelligent sensors, and machine learning algorithms to efficiently monitor and
traffic management systems leveraging machine learning (ML) and control traffic. To show how AI-driven traffic solutions may be used
artificial intelligence (AI) have gained significant attention as in the real world, Ng et al. [12] created a hybrid intelligent traffic
promising solutions to these challenges. Recent studies have signal system to reduce congestion in Hong Kong. To improve
shown that by forecasting traffic patterns and evaluating real-time traffic flow, Patil et al. [13] used deep learning-based techniques for
scheduling and vehicle recognition. A next-generation traffic
control system with adaptive timings and emergency vehicle
prioritizing was proposed by D. S. G et al. [14] to guarantee
efficient traffic flow in urgent circumstances. For smooth road
traffic regulation, Rushi et al. [15] created a sophisticated
intelligent traffic management system that combines machine
learning and the Internet of Things. Similar to this, Tabassum et al.
[16] highlighted adaptive traffic light mechanisms in their
introduction of a density-based traffic control system utilizing IoT
and ML. In order to improve reaction times and lessen congestion,
U et al. [17] installed an intelligent traffic control system for
emergency vehicles based on CNN. In order to enable optimal
decision-making in dynamic traffic conditions, Xinhai et al. [18]
used game theory and reinforcement learning techniques to traffic
signal control. In order to improve vehicle recognition accuracy
and traffic surveillance, Wen-juan et al. [19] investigated the use of
vision sensing technology in urban traffic control. In order to
improve automated traffic monitoring capabilities, Bahadure et al.
[20] used the YOLO object detection model to create a traffic
signal detection and recognition system. The collective insights
from these studies highlight the critical role of ML, IoT, and AI-
driven strategies in intelligent traffic management. These
technologies enable predictive analysis, real-time decision-making,
and adaptive traffic control, ultimately contributing to safer and
more efficient urban mobility. Future advancements in this domain
can further enhance traffic awareness, mitigate congestion, and
improve road safety through continuous innovations in AI-driven
traffic management systems.
2. METHODS
The main procedures for creating a machine learning-based
traffic prediction system are shown in the flowchart. The first step
is data collection, which involves gathering traffic data from
sensors, GPS, and weather APIs, among other sources. The data is
then cleaned, standardized, and formatted in an organized way that
is appropriate for model training during the Data Preprocessing
step. To guarantee appropriate learning and assessment, the dataset Flow chart-1: Proposed methods
is split into training, validation, and testing sets in the Dataset
Splitting stage. In order to identify patterns and trends, the machine 2.1 Data Collection
learning model is trained using historical traffic data. To make sure
the model performs properly when applied to fresh data, the Model In the data collecting process, traffic data is gathered from a
Evaluation stage evaluates the model's performance using the variety of sources, such as weather APIs, road sensors, GPS
validation and test sets. Lastly, the trained model forecasts future devices, and public databases. Important factors that affect traffic
traffic conditions in the Result Prediction stage, which helps with patterns are included in this data, such as vehicle speed, traffic
congestion. volume, accidents, congestion, and weather. For increased
accuracy, real-time data from navigation applications like Waze or
. Google Maps can also be used. To create a trustworthy prediction
model, it is essential to guarantee the correctness, consistency, and
completeness of the data. After being gathered, the data is saved in
a structured format for analysis and preparation, like a database or
CSV file.
2.2 Split the Data
While preserving chronological order, the Train-Test
Split stage separates the preprocessed traffic data into 80%
training and 20% testing. By doing this, data leakage is avoided
and the model is guaranteed to learn from historical trends
without gaining access to data from the future. The testing set
assesses the model's accuracy, while the training set aids in the
recognition of traffic patterns. A dependable and broadly
applicable traffic forecast system is guaranteed by this approach.
2.2.1 Training Set
By finding trends in past traffic data, the machine learning
model is trained using the training set (70–80%). It aids in the
model's learning of correlations between variables like traffic,
weather, and time. The predicted accuracy of the model is
enhanced by a well prepared training set.
2.2.2 Validation Set
To avoid overfitting and adjust model parameters, the
validation set (10–15%) is utilized. It aids in the optimization of
hyperparameters such as model complexity and learning rate.
Long before final testing, this set guarantees the model's
generalization.
2.2.3 Test Set
The testing set (10–20%) assesses how well the finished Fig – Result(traffic prediction)
model performs on data that has never been seen before. It offers 2.6 Model performance
an objective assessment of precision and dependability. To Using MAE, MSE, RMSE, and R2 Score, the models'
replicate real-world forecasts, time-series forecasting uses the performance is assessed for **Linear Regression, Random Forest,
most recent traffic data as the test set. and XGBoost. Because of its sophisticated boosting process,
XGBoost typically offers the best accuracy, although Random
Forest does well by identifying intricate patterns. Due of its
2.3 Model Training simplicity, Linear Regression may have trouble with non-linearity.
Reliable traffic predictions are ensured by selecting the optimal
model based on a better R2 score and lower error levels.
Selecting the best machine learning algorithm for traffic
prediction and training it with historical data are known as model
selection and training. XGBoost, Random Forest, Linear
Regression, and LSTM (for time-series forecasting) are examples
of popular models. During the training phase, the model is fed
preprocessed data, its internal parameters are changed, and
methods such as gradient descent are used to optimize it.
Performance is enhanced through hyperparameter adjustment.
Accurate predictions for traffic, trip time, and vehicle flow are
made possible by a well-trained model that efficiently learns traffic
patterns.
2.4 Model Evalution
The validation and test sets are used in the Model
Evaluation process to gauge how well the trained machine learning
model performs. Accuracy is evaluated using key metrics including Fig – (Model performance)
R-squared (R²), Mean Absolute Error (MAE), and Root Mean
Squared Error (RMSE). Evaluation of time-series models is
centered on how successfully they forecast traffic patterns in the 3 RESULT AND DISSCUSSION
future. Without overfitting, a successful model should generalize
effectively to new data. Model modifications and hyperparameter For traffic prediction, the project assesses Linear
tuning are necessary to increase accuracy if performance is subpar. Regression, Random Forest, and XGBoost. With the lowest errors
and maximum accuracy among them, XGBoost outperformed the
others, making it appropriate for managing intricate traffic patterns.
2.4 Results While Linear Regression struggled with non-linearity, Random
Forest also produced dependable results. The MAE, MSE, RMSE,
The accuracy and efficacy of the trained traffic prediction and R2 Score examination validates that ensemble models are more
model are assessed in the **Results** section. To assess how appropriate for traffic forecasting. Improved traffic management can
successfully the model forecasts future traffic patterns, key result from these insights assistance with real-time traffic
performance indicators like **Mean Absolute Error (MAE), Root monitoring, congestion prediction, and smart city planning.
Mean Squared Error (RMSE), and R-squared (R²)** are employed.
Graphs or dashboards are used to display the results of comparing
the actual traffic statistics with the expected traffic volume. Real- 3.1 Linear Regression
time traffic management may be possible with the model if it A supervised learning algorithm called linear regression is
works well; if not, additional enhancements like feature selection utilized to predict the connection between a dependent variable
or hyperparameter tuning might be required. (traffic flow) and independent variables (features). It is helpful for
comprehending basic trends in traffic patterns since it makes the
assumption that the input features and the anticipated traffic values
have a linear relationship.
Benefits
Interpretability Analyzing trends is made simple using Linear
Regression, which gives a clear picture of how each feature affects
traffic.
Challenges
Inadequate Management of Non-Linearity – When the
correlations are not strictly linear, Linear Regression is less
successful since traffic patterns are frequently complex and
influenced by a variety of factors. FIG –(XG BOOST)
3.2 Random Forest 4. CONCLUSION
To increase prediction accuracy, Random Forest, a
**ensemble learning algorithm**, combines several decision trees. Based on past data, the machine learning-based traffic
It is quite reliable for traffic forecasting since it trains several trees prediction algorithm accurately predicts future traffic conditions.
on various data subsets and averages their predictions. The model assesses important traffic characteristics, such as the
time of day, weather, road type, number of vehicles, and average
speed, using techniques including Linear Regression, Random
3.2.1 benfits
Forest, and XGBoost. With the lowest MAE, MSE, and RMSE
Addresses Non-Linearity For real-world traffic values as well as the greatest R2 score, which indicates superior
patterns, Random Forest is more accurate than Linear Regression prediction accuracy, XGBoost outperformed the other models in
because it can identify intricate correlations in traffic data. the test. Data collection, preprocessing, feature engineering,
model training, evaluation, and visualization were all part of the
3.2.2 Challenges method's organized approach. The findings demonstrated how
Computational Cost Real-time forecasts may be machine learning approaches may greatly improve traffic
slowed down by the additional processing power and time needed forecasts, assisting in improved route planning, traffic
to train numerous decision trees. management, and congestion alleviation.For additional
enhancements, real-time data from APIs (such as Google Maps
and OpenTraffic) can be combined for dynamic updates, and
deep learning models like LSTMs (Long Short-Term Memory)
can be used for sequential traffic prediction. All things
considered, this project demonstrates the effectiveness of
machine learning in traffic analysis, opening the door for
intelligent transportation systems and smart city solutions.
5.ACKNOWLEDGEMENTS
I would like to express my sincere gratitude to B.
Ganga Bhavani mam for her invaluable guidance and
support throughout this research.
6.REFERENCES
[1] S. Deshmukh, N. Badvar, C. Borate and D. Jadhav, "Intelligent
Fig – (random forest) Traffic Signal System Using Machine Learning," 2022 2nd Asian
Conference on Innovation in Technology (ASIANCON), Ravet,
3.3 XG Boost India, 2022, pp. 1-6, doi:
10.1109/ASIANCON55314.2022.9908787.
Extreme Gradient Boosting, or XGBoost, is a sophisticated
ensemble learning technique that uses gradient boosting to [2] G. Meena, D. Sharma and M. Mahrishi, "Traffic Prediction for
optimize performance while building decision trees in a Intelligent Transportation System using Machine
sequential fashion. It is scalable, incredibly effective, and built Learning," 2020 3rd International Conference on Emerging
to manage big datasets with intricate interactions. Technologies in Computer Engineering: Machine Learning and
Internet of Things (ICETCE), Jaipur, India, 2020, pp. 145-148,
3.3.1 Benfits doi: 10.1109/ICETCE48199.2020.9091758.
High Accuracy: XGBoost is the most accurate model in
[3] A.Navaas Roshan, B.Gokulapriyan, C.Siddarth, Priyanka Kokil,
this project since it successfully captures non-linear traffic "Adaptive Traffic Control With TinyML," 2021 Sixth
patterns and interactions between several components. International Conference on Wireless Communications, Signal
Processing and Networking (WiSPNET), Chennai, India, doi:
3.3.2 Challenges 10.1109/WiSPNET51692.2021.9419472.
Computational Cost: Real-time predictions may be
slowed down by the additional processing power and time [4] S. Jain, A. Singh, S. N. Shah, R. Lalam and D. Saxena, "Machine
Learning-Based Real-Time Traffic Control System," 2021 IEEE
needed to train numerous decision trees.
Mysore Sub Section International Conference (MysuruCon),
Hassan, India, 2021, pp. 92-97, doi:
10.1109/MysuruCon52639.2021.9641643.
International Conference on Inventive Computation
[5] R. Zhang, R. Leteurtre, B. Striner, A. Alanazi, A. Alghafis and Technologies (ICICT), Lalitpur, Nepal, 2024, pp. 1-6, doi:
O. K. Tonguz, "Partially Detected Intelligent Traffic Signal 10.1109/ICICT60155.2024.10544736.
Control: Environmental Adaptation," 2019 18th IEEE
International Conference On Machine Learning And [16] H. Tabassum, M. Mohammed Ameer, M. M. Alam, M. Y.
Applications (ICMLA), Boca Raton, FL, USA, 2019, pp. 1956- Sharieff, N. Ahamed and A. Anjum, "Density-Based Traffic
1960, doi: 10.1109/ICMLA.2019.00314. Control System Using IoT and Machine Learning," 2024
International Conference on Knowledge Engineering and
[6] Zhao-sheng Yang, Xin Chen, Yang-shan Tang and Jian-ping Communication Systems (ICKECS), Chikkaballapur, India,
Sun, "Intelligent cooperation control of urban traffic 2024, pp. 1-6, doi: 10.1109/ICKECS61492.2024.10617246.
networks," 2005 International Conference on Machine
Learning and Cybernetics, Guangzhou, China, 2005, pp. 1482- [17] V. U, S. Sarma, Y. M, S. Kr and V. Gv, "CNN Based
1486 Vol. 3, doi: 10.1109/ICMLC.2005.1527178. Intelligent Traffic Control System to Support Emergency
Vehicles," 2022 IEEE International Conference on Electronics,
[7] J. Luo, X. Li and Y. Zheng, "Researches on Intelligent Traffic Computing and Communication Technologies (CONECCT),
Signal Control Based on Deep Reinforcement Bangalore, India, 2022, pp. 1-5, doi:
Learning," 2020 16th International Conference on Mobility, 10.1109/CONECCT55679.2022.9865821.
Sensing and Networking (MSN), Tokyo, Japan, 2020, pp. 729-
734, doi: 10.1109/MSN50589.2020.00124. [18] X. Xinhai and X. Lunhui, "Traffic Signal Control Agent
Interaction Model Based on Game Theory and Reinforcement
[8] S. C, S. Radhika, M. K, S. Ranjith and N. Sasirekha, "An Learning," 2009 International Forum on Computer Science-
intelligent IoT Enabled Traffic queue handling System Using Technology and Applications, Chongqing, China, 2009, pp.
Machine Learning Algorithm," 2022 International 164-168, doi: 10.1109/IFCSTA.2009.47.
Conference on Innovative Computing, Intelligent
Communication and Smart Electrical Systems (ICSES), [19] X. Wen-juan and L. Jian-feng, "Application of vision sensing
Chennai, India, 2022, pp. 1-9, doi: technology in urban intelligent traffic control system," 2018 4th
10.1109/ICSES55317.2022.9914294. International Conference on Computer and Technology
Applications (ICCTA), Istanbul, Turkey, 2018, pp. 74-77, doi:
[9] Hong Dai, Zhao-Sheng Yang and Xiao-Guang Li,
"Hierarchical intelligent control and coordination of urban 10.1109/CATA.2018.8398659.
traffic management systems," 2005 International Conference
on Machine Learning and Cybernetics, Guangzhou, China, [20] N. B. Bahadure, P. D. Patil, R. Birewar, P. Nayyar, A. Shrivastav
2005, pp. 1170-1174 Vol. 2, doi: and M. Oberoi, "Traffic Signal Detection and Recognition from
10.1109/ICMLC.2005.1527120. Real-Scenes Using YOLO," 2023 IEEE Engineering Informatics,
Melbourne, Australia, 2023, pp. 1-5, doi:
[10] W. Radi, H. M. El Badawy, A. Mudassir and H. Kamel,
10.1109/IEEECONF58110.2023.10520597.
"Traffic Accident Management System for Intelligent and
Sustainable Vehicle Networking," 2023 20th ACS/IEEE
International Conference on Computer Systems and 7.BIOGRAPHIES OF AUTHORS
Applications (AICCSA), Giza, Egypt, 2023, pp. 1-7, doi:
10.1109/AICCSA59173.2023.10479241.
Veera Chaitanya currently residing at
[11] V. G, P. J, P. Godwin James, B. Sree S, P. V and S. V M, 1-139, Korlapati Vari Palem, Ambajipeta
"Smart Traffic Management System for Urban Mobility (533214), is a B.Tech student
Enhancement Using RF Sensors, Cameras, and Machine specializing in Artificial Intelligence and
Learning," 2024 International Conference on Power, Energy, Data Science at Bonam Venkata
Control and Transmission Systems (ICPECTS), Chennai, Chalamayya Engineering College,
India, 2024, pp. 1-6, doi: Odalarevu, with an expected graduation
10.1109/ICPECTS62210.2024.10780149. in April 2026. He aims to secure a
position that leverages his strong
[12] S. -C. Ng, C. -P. Kwok, Y. -C. Fung, C. -Y. So and Y. -H. organizational skills, educational
Lam, "A Hybrid Intelligent Traffic Light System for Solving background, and ability to work
Traffic Congestion in Hong Kong," 2020 10th International effectively with others. V.Chai possesses
Conference on Information Science and Technology (ICIST), key skills in communication, self-
Bath, London, and Plymouth, UK, 2020, pp. 258-265, doi: motivation, analytical and critical
10.1109/ICIST49303.2020.9202144. thinking, and dependability. While his
professional experience is listed as a
[13] A. Patil, A. Raorane and J. Kundale, "Enhancing Traffic student, his proactive approach and skill
Management with Deep Learning Based Vehicle Detection set indicate a strong potential for growth
and Scheduling Systems," 2023 International Conference on and contribution in a professional setting.
Modeling, Simulation & Intelligent Computing (MoSICom), For further contact, he can be reached at
Dubai, United Arab Emirates, 2023, pp. 223-227, doi: 8247822655 or via email at
10.1109/MoSICom59118.2023.10458787.
[email protected][14] D. S. G, G. A and L. D, "Next-Generation Traffic Control:
Adaptive Timer and Emergency Vehicle Priority in Intelligent
Traffic Management," 2024 International Conference on E-
mobility, Power Control and Smart Systems (ICEMPS),
Thiruvananthapuram, India, 2024, pp. 1-6, doi:
10.1109/ICEMPS60684.2024.10559373.
[15] T. Rushi, S. M. Zamaan and A. Pravin, "Intelligent Traffic
Management System: An Advanced Solution," 2024
Achanta Gopi currently residing at
[email protected]3-92, Devi Center, Near Kanaka Durga
Temple, Pedapatnam lanka (533247), is
a B.Tech student specializing in
Artificial Intelligence and Data Science
at Bonam Venkata Chalamayya
Engineering College, Odalarevu, with
an expected graduation in April 2026.
He aims to secure a position that
leverages his strong organizational
skills, educational background, and
ability to work effectively with others.
A.Gopi possesses key skills in
communication, self-motivation,
analytical and critical thinking, and
dependability. While his professional
experience is listed as a student, his
proactive approach and skill set indicate
a strong potential for growth and
contribution in a professional setting.
For further contact, he can be reached at
7013972788 or via email at
[email protected]Katikireddy Ajay Mavullu
currently residing at 3-103, Devi Center,
Near Kanaka Durga Temple,
Pedapatnam lanka (533247), is a B.Tech
student specializing in Artificial
Intelligence and Data Science at Bonam
Venkata Chalamayya Engineering
College, Odalarevu, with an expected
graduation in April 2026. He aims to
secure a position that leverages his
strong organizational skills, educational
background, and ability to work
effectively with others. K.Ajay Mavullu
possesses key skills in communication,
self-motivation, analytical and critical
thinking, and dependability. While his
professional experience is listed as a
student, his proactive approach and skill
set indicate a strong potential for growth
and contribution in a professional
setting. For further contact, he can be
reached at 9381361247 or via email at
[email protected]Mrs.Ganga Bhavani Billa is
Research Scholar at college, Koneru
Lakshmaiah Education Foundation
(KLEF) Green Fileds, Vaddeswaram
also Mrs.Ganga Bhavani Billa is
Associate Professor at college Bonam
Venkata Chalamayya Engineering
College,Odalarevu.She holds a M.Tech
degree in Computer Science and
Engineering in GIET
College.,Rajahmundry.Her Research
areas are Machine Learning,Deep
Learning and Artificial Intelligence.She
has number of patents related to
machine learning field and industrial
designs on her innovative ideas and has
been awraded with international patents
and published differnt articles in
international conferences.She can be
contacted at address: Mrs.Ganga
Bhavani Billa is Research Scholar at
college, Koneru Lakshmaiah Education
Foundation (KLEF) Green Fileds,
Vaddeswaram, A.P. – 522302 Email: