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
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 between two cars Fig-1 . AI and ML based integrated traffic management system
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 behaviors, such as using a cell . In order to improve overall traffic efficiency, Deshmukh et al. [1]
phone while operating a motor vehicle, speeding excessively, and presented an intelligent traffic signal system that uses machine
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 intelligent
learning, Artificial intelligence (AI), Predictive modelling, transportation systems. These developments help create more efficient
Data-driven forecasting 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 real-time traffic optimization, is
1. INTRODUCTION another noteworthy addition in this area. Zhang et al. [5] studied
Nowadays, traffic is the main issue everywhere. The growing environmentally adaptive intelligent traffic signal management
population, rising living standards, and hectic lifestyles have forced systems, whereas Jain et al. [4] created a machine learning-based real-
many to own or rent cars, which has contributed to an increase in time traffic control system to promote more seamless urban
pollution and unintentional fatalities. There are several routes to transportation. These methods optimize traffic signals and cut down
commute, which is one of the main causes of the growing traffic on vehicle delays by using data-driven decision-making. Yang et al.
issues. The many forms of transportation include vehicles, buses, [6] investigated intelligent cooperation control for urban traffic
two-wheelers, and autos, among others. We are only a phone call networks, focusing on coordinated traffic flow management, going
away from all of these, and even at midnight, cabs and cars are beyond traffic signal optimization. Deep reinforcement learning was
available. We all utilize some form of transportation, and a large used by Luo et al. [7] to increase the effectiveness of traffic light
percentage of college students and office workers rely on buses, regulation. In the meantime, C et al. [8] shown the possibility of
metros, and cars to get to their destinations on time. This essay aids combining smart sensors with machine learning-based traffic
us in determine the proportion of them who actually understand and management techniques by proposing an IoT-enabled traffic queue
abide by the driving laws. Traffic congestion and road safety have managing system. In order to overcome the scalability issues in urban
become major concerns in modern urban environments due to the traffic management, Dai et al. [9] investigated hierarchical intelligent
rapid increase in vehicular density. Efficient traffic management is control systems. In their study on intelligent vehicle networking and
essential to minimize delays, optimize resource utilization, and traffic accident management, Radi et al. [10] offered insights into how
enhance commuter safety. artificial intelligence (AI) might improve emergency response
Traditional traffic control mechanisms, such as fixed-time traffic systems. In addition, V. G. et al. [11] presented a smart traffic
signals, often fail to adapt to dynamic road conditions, leading to management system that uses cameras, RF sensors, and machine
inefficiencies and increased accident risks. In response, intelligent learning algorithms to efficiently monitor and control traffic. To show
traffic management systems leveraging machine learning (ML) and how AI-driven traffic solutions may be used in the real world, Ng et
artificial intelligence (AI) have gained significant attention as al. [12] created a hybrid intelligent traffic signal system to reduce
promising solutions to these challenges. Recent studies have shown congestion in Hong Kong. To improve traffic flow, Patil et al. [13]
that by forecasting traffic patterns and evaluating real-time data, 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 is split
into training, validation, and testing sets in the Dataset Splitting Flow chart-1: Proposed methods
stage. In order to identify patterns and trends, the machine learning
model is trained using historical traffic data. To make sure the model 2.1 Data Collection
performs properly when applied to fresh data, the Model Evaluation
stage evaluates the model's performance using the validation and test In the data collecting process, traffic data is gathered from a
sets. Lastly, the trained model forecasts future traffic conditions in variety of sources, such as weather APIs, road sensors, GPS devices,
the Result Prediction stage, which helps with congestion. and public databases. Important factors that affect traffic patterns
are included in this data, such as vehicle speed, traffic 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
model performs on data that has never been seen before. It offers Fig – Result(traffic prediction)
an objective assessment of precision and dependability. To 2.6 Model performance
replicate real-world forecasts, time-series forecasting uses the Using MAE, MSE, RMSE, and R2 Score, the models'
most recent traffic data as the test set. performance is assessed for **Linear Regression, Random Forest, and
XGBoost. Because of its sophisticated boosting process,
XGBoost typically offers the best accuracy, although Random
2.3 Model Training Forest does well by identifying intricate patterns. Due of its simplicity,
Linear Regression may have trouble with non-linearity. Reliable
traffic predictions are ensured by selecting the optimal model based
Selecting the best machine learning algorithm for traffic on a better R2 score and lower error levels.
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
R-squared (R²), Mean Absolute Error (MAE), and Root Mean
Squared Error (RMSE). Evaluation of time-series models is centered Fig – (Model performance)
on how successfully they forecast traffic patterns in the future.
Without overfitting, a successful model should generalize
effectively to new data. Model modifications and hyperparameter 3 RESULT AND DISSCUSSION
tuning are necessary to increase accuracy if performance is subpar.
For traffic prediction, the project assesses Linear Regression,
Random Forest, and XGBoost. With the lowest errors and maximum
2.4 Results accuracy among them, XGBoost outperformed the others, making it
appropriate for managing intricate traffic patterns. While Linear
The accuracy and efficacy of the trained traffic prediction Regression struggled with non-linearity, Random Forest also
model are assessed in the **Results** section. To assess how produced dependable results. The MAE, MSE, RMSE, and R2
successfully the model forecasts future traffic patterns, key Score examination validates that ensemble models are more
performance indicators like **Mean Absolute Error (MAE), Root appropriate for traffic forecasting. Improved traffic management can
Mean Squared Error (RMSE), and R-squared (R²)** are employed.
result from these insights assistance with real-time traffic monitoring,
Graphs or dashboards are used to display the results of comparing
congestion prediction, and smart city planning.
the actual traffic statistics with the expected traffic volume. Real-
time traffic management may be possible with the model if it works
well; if not, additional enhancements like feature selection or 3.1 Linear Regression
hyperparameter tuning might be required.
A supervised learning algorithm called linear regression is
utilized to predict the connection between a dependent variable (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. It is quite Based on past data, the machine learning-based traffic
reliable for traffic forecasting since it trains several trees on various prediction algorithm accurately predicts future traffic conditions.
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 patterns, values as well as the greatest R2 score, which indicates superior
Random Forest is more accurate than Linear Regression because it prediction accuracy, XGBoost outperformed the other models in
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 slowed machine learning approaches may greatly improve traffic
down by the additional processing power and time needed to train forecasts, assisting in improved route planning, traffic
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,
India, 2022, pp. 1-6, doi:
3.3 XG Boost 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 Learning," 2020
sequential fashion. It is scalable, incredibly effective, and built 3rd International Conference on Emerging Technologies in
to manage big datasets with intricate interactions. Computer Engineering: Machine Learning and Internet of Things
(ICETCE), Jaipur, India, 2020, pp. 145-148, doi:
10.1109/ICETCE48199.2020.9091758.
3.3.1 Benfits
High Accuracy: XGBoost is the most accurate model in this [3] A.Navaas Roshan, B.Gokulapriyan, C.Siddarth, Priyanka Kokil,
project since it successfully captures non-linear traffic patterns "Adaptive Traffic Control With TinyML," 2021 Sixth
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
[4] S. Jain, A. Singh, S. N. Shah, R. Lalam and D. Saxena, "Machine
down by the additional processing power and time needed to Learning-Based Real-Time Traffic Control System," 2021 IEEE
train numerous decision trees. Mysore Sub Section International Conference (MysuruCon),
Hassan, India, 2021, pp. 92-97, doi:
10.1109/MysuruCon52639.2021.9641643.
Technologies (ICICT), Lalitpur, Nepal, 2024, pp. 1-6, doi:
[5] R. Zhang, R. Leteurtre, B. Striner, A. Alanazi, A. Alghafis and 10.1109/ICICT60155.2024.10544736.
O. K. Tonguz, "Partially Detected Intelligent Traffic Signal
Control: Environmental Adaptation," 2019 18th IEEE [16] H. Tabassum, M. Mohammed Ameer, M. M. Alam, M. Y.
International Conference On Machine Learning And Sharieff, N. Ahamed and A. Anjum, "Density-Based Traffic
Applications (ICMLA), Boca Raton, FL, USA, 2019, pp. 1956- Control System Using IoT and Machine Learning," 2024
1960, doi: 10.1109/ICMLA.2019.00314. International Conference on Knowledge Engineering and
Communication Systems (ICKECS), Chikkaballapur, India,
[6] Zhao-sheng Yang, Xin Chen, Yang-shan Tang and Jian-ping 2024, pp. 1-6, doi: 10.1109/ICKECS61492.2024.10617246.
Sun, "Intelligent cooperation control of urban traffic
networks," 2005 International Conference on Machine Learning [17] V. U, S. Sarma, Y. M, S. Kr and V. Gv, "CNN Based Intelligent
and Cybernetics, Guangzhou, China, 2005, pp. 1482-1486 Vol. Traffic Control System to Support Emergency Vehicles," 2022
3, doi: 10.1109/ICMLC.2005.1527178. IEEE International Conference on Electronics, Computing and
Communication Technologies (CONECCT), Bangalore, India,
[7] J. Luo, X. Li and Y. Zheng, "Researches on Intelligent Traffic 2022, pp. 1-5, doi: 10.1109/CONECCT55679.2022.9865821.
Signal Control Based on Deep Reinforcement Learning," 2020
16th International Conference on Mobility, Sensing and [18] X. Xinhai and X. Lunhui, "Traffic Signal Control Agent
Networking (MSN), Tokyo, Japan, 2020, pp. 729-734, doi: Interaction Model Based on Game Theory and Reinforcement
10.1109/MSN50589.2020.00124. Learning," 2009 International Forum on Computer Science-
Technology and Applications, Chongqing, China, 2009, pp. 164-
[8] S. C, S. Radhika, M. K, S. Ranjith and N. Sasirekha, "An 168, doi: 10.1109/IFCSTA.2009.47.
intelligent IoT Enabled Traffic queue handling System Using
Machine Learning Algorithm," 2022 International Conference [19] X. Wen-juan and L. Jian-feng, "Application of vision sensing
on Innovative Computing, Intelligent Communication and technology in urban intelligent traffic control system," 2018 4th
Smart Electrical Systems (ICSES), Chennai, India, 2022, pp. 1- International Conference on Computer and Technology
9, doi: 10.1109/ICSES55317.2022.9914294.
Applications (ICCTA), Istanbul, Turkey, 2018, pp. 74-77, doi:
[9] Hong Dai, Zhao-Sheng Yang and Xiao-Guang Li, 10.1109/CATA.2018.8398659.
"Hierarchical intelligent control and coordination of urban
traffic management systems," 2005 International Conference [20] N. B. Bahadure, P. D. Patil, R. Birewar, P. Nayyar, A. Shrivastav
on Machine Learning and Cybernetics, Guangzhou, China, and M. Oberoi, "Traffic Signal Detection and Recognition from
2005, pp. 1170-1174 Vol. 2, doi: Real-Scenes Using YOLO," 2023 IEEE Engineering Informatics,
10.1109/ICMLC.2005.1527120. Melbourne, Australia, 2023, pp. 1-5, doi:
10.1109/IEEECONF58110.2023.10520597.
[10] W. Radi, H. M. El Badawy, A. Mudassir and H. Kamel,
"Traffic Accident Management System for Intelligent and
Sustainable Vehicle Networking," 2023 20th ACS/IEEE 7.BIOGRAPHIES OF AUTHORS
International Conference on Computer Systems and
Applications (AICCSA), Giza, Egypt, 2023, pp. 1-7, doi:
10.1109/AICCSA59173.2023.10479241. Veera Chaitanya currently residing
at 1-139, Korlapati Vari Palem,
[11] V. G, P. J, P. Godwin James, B. Sree S, P. V and S. V M, Ambajipeta (533214), is a B.Tech
"Smart Traffic Management System for Urban Mobility student specializing in Artificial
Enhancement Using RF Sensors, Cameras, and Machine Intelligence and Data Science at Bonam
Learning," 2024 International Conference on Power, Energy, Venkata Chalamayya Engineering
Control and Transmission Systems (ICPECTS), Chennai, College, Odalarevu, with an expected
India, 2024, pp. 1-6, doi: graduation in April 2026. He aims to
10.1109/ICPECTS62210.2024.10780149. secure a position that leverages his
strong organizational skills, educational
[12] S. -C. Ng, C. -P. Kwok, Y. -C. Fung, C. -Y. So and Y. -H. Lam, background, and ability to work
"A Hybrid Intelligent Traffic Light System for Solving Traffic effectively with others. V.Chai
Congestion in Hong Kong," 2020 10th International possesses key skills in communication,
Conference on Information Science and Technology (ICIST), self-motivation, analytical and critical
Bath, London, and Plymouth, UK, 2020, pp. 258-265, doi: thinking, and dependability. While his
10.1109/ICIST49303.2020.9202144. professional experience is listed as a
student, his proactive approach and skill
[13] A. Patil, A. Raorane and J. Kundale, "Enhancing Traffic set indicate a strong potential for growth
Management with Deep Learning Based Vehicle Detection and and contribution in a professional
Scheduling Systems," 2023 International Conference on setting. For further contact, he can be
Modeling, Simulation & Intelligent Computing (MoSICom), reached at 8247822655 or via email at
Dubai, United Arab Emirates, 2023, pp. 223-227, doi:
[email protected] 10.1109/MoSICom59118.2023.10458787. Achanta Gopi currently residing at
3-92, Devi Center, Near Kanaka Durga
[14] D. S. G, G. A and L. D, "Next-Generation Traffic Control: Temple, Pedapatnam lanka (533247), is
Adaptive Timer and Emergency Vehicle Priority in Intelligent a B.Tech student specializing in
Traffic Management," 2024 International Conference on E- Artificial Intelligence and Data Science
mobility, Power Control and Smart Systems (ICEMPS), at Bonam Venkata Chalamayya
Thiruvananthapuram, India, 2024, pp. 1-6, doi: Engineering College, Odalarevu, with
10.1109/ICEMPS60684.2024.10559373. an expected graduation in April 2026.
He aims to secure a position that
[15] T. Rushi, S. M. Zamaan and A. Pravin, "Intelligent Traffic leverages his strong organizational
Management System: An Advanced Solution," 2024 skills, educational background, and
International Conference on Inventive Computation
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:
[email protected]