e-ISSN: 2582-5208
International Research Journal of Modernization in Engineering Technology and Science
( Peer-Reviewed, Open Access, Fully Refereed International Journal )
Volume:04/Issue:03/March-2022 Impact Factor- 6.752 [Link]
ROAD ACCIDENT ANALYSIS USING MACHINE LEARNING
Ashritha Sripuram*1, Tanneru Jayasree*2, Thota Vaishnavi*3,
Vanteru Rohith Reddy*4, Dr. K. Purna Chand Mtech*5
*1,2,3,4Student, Department Of Computer Science And Engineering, B V Raju Institute Of
Technology, Medak, Telangana State, India.
*5Associate Professor, Department Of Computer Science And Engineering, B V Raju Institute Of
Technology, Medak, Telangana State, India.
ABSTRACT
Although the vehicle industry has numerous possibilities to create and construct safety features, road accidents
are unavoidable. In both urban and rural locations, there are a large number of accidents. By constructing an
accurate prediction model capable of automatically separating distinct unintentional occurrences, patterns
associated with diverse circumstances can be recognised. These clusters will aid in the prevention of accidents
and the development of safety measures. We believe that by combining scientific measures with low-budget
resources, we can achieve the greatest possible reduction in accident rates. Using the best-suited algorithm, the
acquired data will be examined, integrated, and grouped together depending on various restrictions. This
estimate will aid in the analysis and identification of the fault as well as the causes of the incidents.
Keywords: Traffic Accident, Data Mining, Machine Learning, Decision Trees, Random Forest, Linear Regression.
I. INTRODUCTION
The efficient use of accident records is contingent on a number of criteria, including data accuracy, record
retention, and data analysis. Traffic accidents have a tremendous influence on society since they result in a high
number of fatalities and injuries. In recent years, there has been a surge in research on what factors have a
substantial impact on the severity of driver injuries caused by road accidents. There are numerous techniques
of studying this subject that have been used in this case. According to a recent study, residential and retail areas
are more dangerous than village regions. As one may expect, the frequency of casualties was higher near the
zones of residence, probably due to the increased exposure. According to a study, casualty rates in residential
areas are categorized as "relatively disadvantaged" and "substantially higher" than in "relatively prosperous"
areas.
II. METHODOLOGY
Here we have compared various machine learning methods for Road Accident Analysis .Below you can see the a
Architecture Diagram of Project.
Figure 1
Explanation of key functions
The following functions are used:
[Link](): Matplotlib -Grids. The grid() function of the axis object toggles the visibility of the grid inside the
figure. You can also see the grid's major / minor (or both) ticks.. Additionally color, line styleand line width
propertiescanbeset in the grid() function.
[Link] @International Research Journal of Modernization in Engineering, Technology and Science
[1364]
e-ISSN: 2582-5208
International Research Journal of Modernization in Engineering Technology and Science
( Peer-Reviewed, Open Access, Fully Refereed International Journal )
Volume:04/Issue:03/March-2022 Impact Factor- 6.752 [Link]
[Link](): The ioff() function in pyplot module of matplotlib library is used to turn the interactive mode off.
Parameters: There are no parameters accepted by this procedure. Returns: There is no value returned by
this procedure.
[Link](): The info() function prints a short overview of a Data Frame. This method prints information about
a Data Frame, such as the index and column dtypes, non-null values, and memory consumption.
[Link](): If you are using Matplotlib from within a script, the function [Link]() is your friend. [Link]()
initiates an event loop, searches for all currently active figure objects, and displays your figure or figures in
one or more interactive windows.
[Link](): isnull() function detect missing values in the given series object. If the values are NA, it returns a
boolean same-sized object. Missing values gets mapped to True and non-missing value gets mapped to false.
Implementation
Figure 2
Explanation of different modules
• Collection of Data: In this phase the data is collected from different sources.(Example:Kaggel)
• Data Cleaning and Processing: Once the data is collected by applying some data cleaning methods we
remove the errors and process the data.
• Train Data: Once the data is cleaned then we apply some machine learning algorithms like (Random Forest,
Logestic Regression, Decision Tree).
• Test Data: Once the data is trained with the appropriate machine learning algorithms then the data is
tested.
• Prediction & Results: The tested data is analyzed and the results are predicted and analyzed.
III. MODELING AND ANALYSIS
To predict the accidents under the given conditions, we decided compared the accuracy of 5 algorithms and
choose the one that gave the highest score. Machine learning (ML) is the study of algorithms and statistical models
that computer systems use to complete a task without utilising explicit instructions, instead relying on patterns and
[Link] @International Research Journal of Modernization in Engineering, Technology and Science
[1365]
e-ISSN: 2582-5208
International Research Journal of Modernization in Engineering Technology and Science
( Peer-Reviewed, Open Access, Fully Refereed International Journal )
Volume:04/Issue:03/March-2022 Impact Factor- 6.752 [Link]
inference. Artificial intelligence is seen as a subset of it. Machine learning algorithms build a mathematical model
based on sample data, known as "training data”, in order to make predictions or decisions without being explicitly
programmed to perform the task. Models are created using accident data records which can help to understand the
characteristics of many features like driver’s behavior, roadway conditions, light condition, weather conditions and
so on. These models can study and used to predict accidents based on weather, time of the day, region etc. The
algorithms chosen for this project are Decision Tree, Random Forest, Linear Regression and Logistic Regression.
Decision tree
The supervised learning algorithm family includes the Decision Tree algorithm. The decision tree approach, unlike
other supervised learning algorithms, may be utilized to solve regression and classification issues as well. The goal of
employing a Decision Tree is to build a training model that can be used to predict the class or value of target variables
by learning decision rules inferred from previous data (training data). In comparison to other classification
algorithms, the Decision Trees algorithm is quite simple to comprehend. To attempt to solve the problem, the
decision tree algorithm employs tree representation. Each attribute is represented by an internal node of the tree,
whereas each class label is represented by a leaf node.
Random Forest
Random forest is a supervised learning technique for classifying and forecasting data. It is, however, largely used
to overcome categorization problems. As we all know, trees make up a forest, and more trees implies a healthier
forest. The random forest technique, on the other hand, builds decision trees from data samples, extracts
predictions from each, and then votes on the best alternative. Because it averages the outc omes to avoid over-
fitting, it's a better ensemble method than a single decision tree.
Logistic Regression
A supervised learning classification algorithm used to predict the likelihood of a target variable is known as logistic
regression. Because the nature of the target or dependent variable is dichotomous, there are only two viable classes.
In simple terms, the dependent variable is binary in nature, with data represented as 1 (yes) or 0 (no). P(Y=1) as a
function of X is predicted mathematically by a logistic regression model.
IV. RESULTS AND DISCUSSION
Accuracy is used to estimate testing and validation in Machine Learning models. The data is initially separated
into two sets: training and testing. The model is trained using a training set of data, and the remainder of the
data, known as the testing set, is used to determine the model's correctness. The model's accuracy is the most
important validation factor.
The Machine Learning model is trained using the training data. For training and creating the model, we use
three machine learning algorithms.
Reading csv files and importing modules
Figure 3
[Link] @International Research Journal of Modernization in Engineering, Technology and Science
[1366]
e-ISSN: 2582-5208
International Research Journal of Modernization in Engineering Technology and Science
( Peer-Reviewed, Open Access, Fully Refereed International Journal )
Volume:04/Issue:03/March-2022 Impact Factor- 6.752 [Link]
Data Cleaning
Figure 4
Data Visualization
Figure 5
[Link] @International Research Journal of Modernization in Engineering, Technology and Science
[1367]
e-ISSN: 2582-5208
International Research Journal of Modernization in Engineering Technology and Science
( Peer-Reviewed, Open Access, Fully Refereed International Journal )
Volume:04/Issue:03/March-2022 Impact Factor- 6.752 [Link]
Figure 6
Correlation Between variables
Figure 7
Machine Learning
Figure 8
[Link] @International Research Journal of Modernization in Engineering, Technology and Science
[1368]
e-ISSN: 2582-5208
International Research Journal of Modernization in Engineering Technology and Science
( Peer-Reviewed, Open Access, Fully Refereed International Journal )
Volume:04/Issue:03/March-2022 Impact Factor- 6.752 [Link]
Normalize the data
Figure 9
Random Forest
Figure 10
[Link] @International Research Journal of Modernization in Engineering, Technology and Science
[1369]
e-ISSN: 2582-5208
International Research Journal of Modernization in Engineering Technology and Science
( Peer-Reviewed, Open Access, Fully Refereed International Journal )
Volume:04/Issue:03/March-2022 Impact Factor- 6.752 [Link]
Decision tree
Figure 11
Logistic Regression
Figure 12
Figure 13
[Link] @International Research Journal of Modernization in Engineering, Technology and Science
[1370]
e-ISSN: 2582-5208
International Research Journal of Modernization in Engineering Technology and Science
( Peer-Reviewed, Open Access, Fully Refereed International Journal )
Volume:04/Issue:03/March-2022 Impact Factor- 6.752 [Link]
V. CONCLUSION
As we have tried three different algorithms to predict the road accident, it was clear that Decision tree(77.78%)
and Random Forest(86.86%) performed much better in terms of predicting all the classes of road accident.
Logistic regression(67.48%) has better accuracy but it does not mean it did better than other algorithm. It can
be concluded that road accident cases are hugely affected by the factors such as types of vehicles, age of driver,
vehicle condition and road structure. In order to take this a step ahead we can make an application which gives
efficient prediction of road accidents based on machine learning.
VI. REFERENCES
[1] Peden,M. (2004) "World report on road traffic injury prevention". Geneva: World Health Organization
[2] S. Shanthi and Dr. R. Geetha Ramani, “Gender Specific Classification of Road Accident Patterns through
Data Mining Techniques”, IEEE-International Conference on Advances in Engineering, Science and
Management (ICAESM -2012) March 30, 31, 2012.
[3] M. Chang, L. Y., & Chen, W. C. (2005). "Data mining of tree- based models to analyse freeway accident
frequency". Journal of Safety Research, 36(4), 365-375.
[4] S. Kumar and D. Toshniwal, "A data mining approach to characterize road accident locations," Journal
of Modern Transportation(2016), vol. 24, issue no. 1, pp. 62-72.
[5] T. Adhikary, A. K. Das, M. A. Razzaque, A. Almogren, M. Alrubaian, and M. M. Hassan, “Quality of Service
Aware Reliable Task Scheduling in Vehicular Cloud Computing,” Mobile Networks and Applications,
Volume 21, Issue 3, pp 482-493, June 2016.
[6] K. M. Habibullah, A. Alam, S. Saha, A. Amin and A. K. Das, " A Driver-Centric Carpooling: Optimal Route
Finding Model using Heuristic Multi–Objective Search," 2019 4th International Conference on
Computer and Communication Systems (ICCCS), Singapore, 2019.
[Link] @International Research Journal of Modernization in Engineering, Technology and Science
[1371]