\documentclass[11pt,twoside]{article}\makeatletter

\IfFileExists{xcolor.sty}%
  {\RequirePackage{xcolor}}%
  {\RequirePackage{color}}
\usepackage{colortbl}
\usepackage{wrapfig}
\usepackage{ifxetex}
\ifxetex
  \usepackage{fontspec}
  \usepackage{xunicode}
  \catcode`⃥=\active \def⃥{\textbackslash}
  \catcode`❴=\active \def❴{\{}
  \catcode`❵=\active \def❵{\}}
  \def\textJapanese{\fontspec{Noto Sans CJK JP}}
  \def\textChinese{\fontspec{Noto Sans CJK SC}}
  \def\textKorean{\fontspec{Noto Sans CJK KR}}
  \setmonofont{DejaVu Sans Mono}
  
\else
  \IfFileExists{utf8x.def}%
   {\usepackage[utf8x]{inputenc}
      \PrerenderUnicode{–}
    }%
   {\usepackage[utf8]{inputenc}}
  \usepackage[english]{babel}
  \usepackage[T1]{fontenc}
  \usepackage{float}
  \usepackage[]{ucs}
  \uc@dclc{8421}{default}{\textbackslash }
  \uc@dclc{10100}{default}{\{}
  \uc@dclc{10101}{default}{\}}
  \uc@dclc{8491}{default}{\AA{}}
  \uc@dclc{8239}{default}{\,}
  \uc@dclc{20154}{default}{ }
  \uc@dclc{10148}{default}{>}
  \def\textschwa{\rotatebox{-90}{e}}
  \def\textJapanese{}
  \def\textChinese{}
  \IfFileExists{tipa.sty}{\usepackage{tipa}}{}
\fi
\def\exampleFont{\ttfamily\small}
\DeclareTextSymbol{\textpi}{OML}{25}
\usepackage{relsize}
\RequirePackage{array}
\def\@testpach{\@chclass
 \ifnum \@lastchclass=6 \@ne \@chnum \@ne \else
  \ifnum \@lastchclass=7 5 \else
   \ifnum \@lastchclass=8 \tw@ \else
    \ifnum \@lastchclass=9 \thr@@
   \else \z@
   \ifnum \@lastchclass = 10 \else
   \edef\@nextchar{\expandafter\string\@nextchar}%
   \@chnum
   \if \@nextchar c\z@ \else
    \if \@nextchar l\@ne \else
     \if \@nextchar r\tw@ \else
   \z@ \@chclass
   \if\@nextchar |\@ne \else
    \if \@nextchar !6 \else
     \if \@nextchar @7 \else
      \if \@nextchar (8 \else
       \if \@nextchar )9 \else
  10
  \@chnum
  \if \@nextchar m\thr@@\else
   \if \@nextchar p4 \else
    \if \@nextchar b5 \else
   \z@ \@chclass \z@ \@preamerr \z@ \fi \fi \fi \fi
   \fi \fi  \fi  \fi  \fi  \fi  \fi \fi \fi \fi \fi \fi}
\gdef\arraybackslash{\let\\=\@arraycr}
\def\@textsubscript#1{{\m@th\ensuremath{_{\mbox{\fontsize\sf@size\z@#1}}}}}
\def\Panel#1#2#3#4{\multicolumn{#3}{){\columncolor{#2}}#4}{#1}}
\def\abbr{}
\def\corr{}
\def\expan{}
\def\gap{}
\def\orig{}
\def\reg{}
\def\ref{}
\def\sic{}
\def\persName{}\def\name{}
\def\placeName{}
\def\orgName{}
\def\textcal#1{{\fontspec{Lucida Calligraphy}#1}}
\def\textgothic#1{{\fontspec{Lucida Blackletter}#1}}
\def\textlarge#1{{\large #1}}
\def\textoverbar#1{\ensuremath{\overline{#1}}}
\def\textquoted#1{‘#1’}
\def\textsmall#1{{\small #1}}
\def\textsubscript#1{\@textsubscript{\selectfont#1}}
\def\textxi{\ensuremath{\xi}}
\def\titlem{\itshape}
\newenvironment{biblfree}{}{\ifvmode\par\fi }
\newenvironment{bibl}{}{}
\newenvironment{byline}{\vskip6pt\itshape\fontsize{16pt}{18pt}\selectfont}{\par }
\newenvironment{citbibl}{}{\ifvmode\par\fi }
\newenvironment{docAuthor}{\ifvmode\vskip4pt\fontsize{16pt}{18pt}\selectfont\fi\itshape}{\ifvmode\par\fi }
\newenvironment{docDate}{}{\ifvmode\par\fi }
\newenvironment{docImprint}{\vskip 6pt}{\ifvmode\par\fi }
\newenvironment{docTitle}{\vskip6pt\bfseries\fontsize{22pt}{25pt}\selectfont}{\par }
\newenvironment{msHead}{\vskip 6pt}{\par}
\newenvironment{msItem}{\vskip 6pt}{\par}
\newenvironment{rubric}{}{}
\newenvironment{titlePart}{}{\par }

\newcolumntype{L}[1]{){\raggedright\arraybackslash}p{#1}}
\newcolumntype{C}[1]{){\centering\arraybackslash}p{#1}}
\newcolumntype{R}[1]{){\raggedleft\arraybackslash}p{#1}}
\newcolumntype{P}[1]{){\arraybackslash}p{#1}}
\newcolumntype{B}[1]{){\arraybackslash}b{#1}}
\newcolumntype{M}[1]{){\arraybackslash}m{#1}}
\definecolor{label}{gray}{0.75}
\def\unusedattribute#1{\sout{\textcolor{label}{#1}}}
\DeclareRobustCommand*{\xref}{\hyper@normalise\xref@}
\def\xref@#1#2{\hyper@linkurl{#2}{#1}}
\begingroup
\catcode`\_=\active
\gdef_#1{\ensuremath{\sb{\mathrm{#1}}}}
\endgroup
\mathcode`\_=\string"8000
\catcode`\_=12\relax

\usepackage[a4paper,twoside,lmargin=1in,rmargin=1in,tmargin=1in,bmargin=1in,marginparwidth=0.75in]{geometry}
\usepackage{framed}

\definecolor{shadecolor}{gray}{0.95}
\usepackage{longtable}
\usepackage[normalem]{ulem}
\usepackage{fancyvrb}
\usepackage{fancyhdr}
\usepackage{graphicx}
\usepackage{marginnote}

\renewcommand{\@cite}[1]{#1}


\renewcommand*{\marginfont}{\itshape\footnotesize}

\def\Gin@extensions{.pdf,.png,.jpg,.mps,.tif}

  \pagestyle{fancy}

\usepackage[pdftitle={Detailed Analysis and Identification of Key Factors Resulting in Motor Accidents across the UK},
 pdfauthor={}]{hyperref}
\hyperbaseurl{}

	 \paperwidth210mm
	 \paperheight297mm
              
\def\@pnumwidth{1.55em}
\def\@tocrmarg {2.55em}
\def\@dotsep{4.5}
\setcounter{tocdepth}{3}
\clubpenalty=8000
\emergencystretch 3em
\hbadness=4000
\hyphenpenalty=400
\pretolerance=750
\tolerance=2000
\vbadness=4000
\widowpenalty=10000

\renewcommand\section{\@startsection {section}{1}{\z@}%
     {-1.75ex \@plus -0.5ex \@minus -.2ex}%
     {0.5ex \@plus .2ex}%
     {\reset@font\Large\bfseries}}
\renewcommand\subsection{\@startsection{subsection}{2}{\z@}%
     {-1.75ex\@plus -0.5ex \@minus- .2ex}%
     {0.5ex \@plus .2ex}%
     {\reset@font\Large}}
\renewcommand\subsubsection{\@startsection{subsubsection}{3}{\z@}%
     {-1.5ex\@plus -0.35ex \@minus -.2ex}%
     {0.5ex \@plus .2ex}%
     {\reset@font\large}}
\renewcommand\paragraph{\@startsection{paragraph}{4}{\z@}%
     {-1ex \@plus-0.35ex \@minus -0.2ex}%
     {0.5ex \@plus .2ex}%
     {\reset@font\normalsize}}
\renewcommand\subparagraph{\@startsection{subparagraph}{5}{\parindent}%
     {1.5ex \@plus1ex \@minus .2ex}%
     {-1em}%
     {\reset@font\normalsize\bfseries}}


\def\l@section#1#2{\addpenalty{\@secpenalty} \addvspace{1.0em plus 1pt}
 \@tempdima 1.5em \begingroup
 \parindent \z@ \rightskip \@pnumwidth 
 \parfillskip -\@pnumwidth 
 \bfseries \leavevmode #1\hfil \hbox to\@pnumwidth{\hss #2}\par
 \endgroup}
\def\l@subsection{\@dottedtocline{2}{1.5em}{2.3em}}
\def\l@subsubsection{\@dottedtocline{3}{3.8em}{3.2em}}
\def\l@paragraph{\@dottedtocline{4}{7.0em}{4.1em}}
\def\l@subparagraph{\@dottedtocline{5}{10em}{5em}}
\@ifundefined{c@section}{\newcounter{section}}{}
\@ifundefined{c@chapter}{\newcounter{chapter}}{}
\newif\if@mainmatter 
\@mainmattertrue
\def\chaptername{Chapter}
\def\frontmatter{%
  \pagenumbering{roman}
  \def\thechapter{\@roman\c@chapter}
  \def\theHchapter{\roman{chapter}}
  \def\thesection{\@roman\c@section}
  \def\theHsection{\roman{section}}
  \def\@chapapp{}%
}
\def\mainmatter{%
  \cleardoublepage
  \def\thechapter{\@arabic\c@chapter}
  \setcounter{chapter}{0}
  \setcounter{section}{0}
  \pagenumbering{arabic}
  \setcounter{secnumdepth}{6}
  \def\@chapapp{\chaptername}%
  \def\theHchapter{\arabic{chapter}}
  \def\thesection{\@arabic\c@section}
  \def\theHsection{\arabic{section}}
}
\def\backmatter{%
  \cleardoublepage
  \setcounter{chapter}{0}
  \setcounter{section}{0}
  \setcounter{secnumdepth}{2}
  \def\@chapapp{\appendixname}%
  \def\thechapter{\@Alph\c@chapter}
  \def\theHchapter{\Alph{chapter}}
  \appendix
}
\newenvironment{bibitemlist}[1]{%
   \list{\@biblabel{\@arabic\c@enumiv}}%
       {\settowidth\labelwidth{\@biblabel{#1}}%
        \leftmargin\labelwidth
        \advance\leftmargin\labelsep
        \@openbib@code
        \usecounter{enumiv}%
        \let\p@enumiv\@empty
        \renewcommand\theenumiv{\@arabic\c@enumiv}%
	}%
  \sloppy
  \clubpenalty4000
  \@clubpenalty \clubpenalty
  \widowpenalty4000%
  \sfcode`\.\@m}%
  {\def\@noitemerr
    {\@latex@warning{Empty `bibitemlist' environment}}%
    \endlist}

\def\tableofcontents{\section*{\contentsname}\@starttoc{toc}}
\parskip0pt
\parindent1em
\def\Panel#1#2#3#4{\multicolumn{#3}{){\columncolor{#2}}#4}{#1}}
\newenvironment{reflist}{%
  \begin{raggedright}\begin{list}{}
  {%
   \setlength{\topsep}{0pt}%
   \setlength{\rightmargin}{0.25in}%
   \setlength{\itemsep}{0pt}%
   \setlength{\itemindent}{0pt}%
   \setlength{\parskip}{0pt}%
   \setlength{\parsep}{2pt}%
   \def\makelabel##1{\itshape ##1}}%
  }
  {\end{list}\end{raggedright}}
\newenvironment{sansreflist}{%
  \begin{raggedright}\begin{list}{}
  {%
   \setlength{\topsep}{0pt}%
   \setlength{\rightmargin}{0.25in}%
   \setlength{\itemindent}{0pt}%
   \setlength{\parskip}{0pt}%
   \setlength{\itemsep}{0pt}%
   \setlength{\parsep}{2pt}%
   \def\makelabel##1{\upshape ##1}}%
  }
  {\end{list}\end{raggedright}}
\newenvironment{specHead}[2]%
 {\vspace{20pt}\hrule\vspace{10pt}%
  \phantomsection\label{#1}\markright{#2}%

  \pdfbookmark[2]{#2}{#1}%
  \hspace{-0.75in}{\bfseries\fontsize{16pt}{18pt}\selectfont#2}%
  }{}
      \def\TheFullDate{2021-07-15 (revised: 15 July 2021)}
\def\TheID{10.34257/GJCSTDVOL21IS1PG1\makeatother }
\def\TheDate{2021-07-15}
\title{Detailed Analysis and Identification of Key Factors Resulting in Motor Accidents across the UK}
\author{}\makeatletter 
\makeatletter
\newcommand*{\cleartoleftpage}{%
  \clearpage
    \if@twoside
    \ifodd\c@page
      \hbox{}\newpage
      \if@twocolumn
        \hbox{}\newpage
      \fi
    \fi
  \fi
}
\makeatother
\makeatletter
\thispagestyle{empty}
\markright{\@title}\markboth{\@title}{\@author}
\renewcommand\small{\@setfontsize\small{9pt}{11pt}\abovedisplayskip 8.5\p@ plus3\p@ minus4\p@
\belowdisplayskip \abovedisplayskip
\abovedisplayshortskip \z@ plus2\p@
\belowdisplayshortskip 4\p@ plus2\p@ minus2\p@
\def\@listi{\leftmargin\leftmargini
               \topsep 2\p@ plus1\p@ minus1\p@
               \parsep 2\p@ plus\p@ minus\p@
               \itemsep 1pt}
}
\makeatother
\fvset{frame=single,numberblanklines=false,xleftmargin=5mm,xrightmargin=5mm}
\fancyhf{} 
\setlength{\headheight}{14pt}
\fancyhead[LE]{\bfseries\leftmark} 
\fancyhead[RO]{\bfseries\rightmark} 
\fancyfoot[RO]{}
\fancyfoot[CO]{\thepage}
\fancyfoot[LO]{\TheID}
\fancyfoot[LE]{}
\fancyfoot[CE]{\thepage}
\fancyfoot[RE]{\TheID}
\hypersetup{citebordercolor=0.75 0.75 0.75,linkbordercolor=0.75 0.75 0.75,urlbordercolor=0.75 0.75 0.75,bookmarksnumbered=true}
\fancypagestyle{plain}{\fancyhead{}\renewcommand{\headrulewidth}{0pt}}

\date{}
\usepackage{authblk}

\providecommand{\keywords}[1]
{
\footnotesize
  \textbf{\textit{Index terms---}} #1
}

\usepackage{graphicx,xcolor}
\definecolor{GJBlue}{HTML}{273B81}
\definecolor{GJLightBlue}{HTML}{0A9DD9}
\definecolor{GJMediumGrey}{HTML}{6D6E70}
\definecolor{GJLightGrey}{HTML}{929497} 

\renewenvironment{abstract}{%
   \setlength{\parindent}{0pt}\raggedright
   \textcolor{GJMediumGrey}{\rule{\textwidth}{2pt}}
   \vskip16pt
   \textcolor{GJBlue}{\large\bfseries\abstractname\space}
}{%   
   \vskip8pt
   \textcolor{GJMediumGrey}{\rule{\textwidth}{2pt}}
   \vskip16pt
}

\usepackage[absolute,overlay]{textpos}

\makeatother 
      \usepackage{lineno}
      \linenumbers
      
\begin{document}

             \author[1]{Harshita  Garg}

             \affil[1]{  Birkbeck University, London}

\renewcommand\Authands{ and }

\date{\small \em Received: 12 June 2021 Accepted: 1 July 2021 Published: 15 July 2021}

\maketitle


\begin{abstract}
        


Motor accidents across the globe amount to a large number of deaths every year. The collisions result in not just the personal injury to people involved but also in the loss of money to the motor insurance companies, trauma to the people involved, and added pressure on the emergency services. With the help of data analytics techniques, this project aims to identify critical factors that might contribute to the accidents. Upon investigating the temporal features and geo-spatial features of the motor accident locations, we tried to establish a correlation between the accident intensity and its key factors. For this exploratory analysis, we also considered weather conditions and daily average traffic flow data. We then trained Supervised learning models on the data to find out the best performing multi-label classification model.

\end{abstract}


\keywords{supervised learning; accident analysis; multilabel classification.}

\begin{textblock*}{18cm}(1cm,1cm) % {block width} (coords) 
\textcolor{GJBlue}{\LARGE Global Journals \LaTeX\ JournalKaleidoscope\texttrademark}
\end{textblock*}

\begin{textblock*}{18cm}(1.4cm,1.5cm) % {block width} (coords) 
\textcolor{GJBlue}{\footnotesize \\ Artificial Intelligence formulated this projection for compatibility purposes from the original article published at Global Journals. However, this technology is currently in beta. \emph{Therefore, kindly ignore odd layouts, missed formulae, text, tables, or figures.}}
\end{textblock*}


\begin{textblock*}{10cm}(1.05cm,3cm)
{{\textit{CrossRef DOI of original article:}} \underline{10.34257/GJCSTDVOL21IS1PG1}}
\end{textblock*}\let\tabcellsep& 	 	 		 
\section[{Introduction}]{Introduction}\par
round the world, every year, more than 1.25 million people are killed and 50 million are injured in road traffic accidents. (Source -Express, road safety facts \hyperref[b0]{[1]}) The source claims that "Every day, on average, five people are killed and 64 seriously injured on UK roads." Driving is considered the most dangerous activity we do every day.\par
Several factors contribute to road accidents. Some of these are -severe weather conditions, the distraction of driver, failure to give or understand appropriate signals, reduced motor skills due to old age, or alcohol consumption.\par
If there was a way to find the key factors responsible for motor accidents happening on the roads, lots of these effects could be minimized. If the hotspots for accidents could be identified, emergency services could be put on high alert in those areas, increasing the response time and potentially reducing the loss of life. If we can predict the likelihood of a crash in real-time, the driver could be warned of potential danger. The government can issue advisory to all the motorists on the accident's hotspots or put signboards to notify the road users. 
\section[{II.}]{II.} 
\section[{Literature Review}]{Literature Review}\par
Accidents dataset for the UK region, which is available at the government of UK website \hyperref[b1]{[2]}, is an immensely popular dataset and many academicians have based their research on this, with some variations.\par
Jinning You et al. attempted to calculate the crash likelihood in \hyperref[b2]{[3]}. They used web crawling techniques to obtain live weather data and oversampling to solve the problem of inherent imbalance in the dataset and applied random forest and SVM classifier algorithms on the training dataset. SVM classifier performed better for them when used with the web crawling techniques.\par
The relationship between road accidents and traffic on the roads has got a lot of attention in recent years.  {\ref Salifu [4]} used a similar approach for the accident prediction for unsignaled urban junctions in Ghana. He combined accident data with the Annual Average Data Flow and analyzed the effect on different kinds of junctions like signaled junctions, unsignaled junctions, T-junctions, X-junctions etc.\par
Traffic data visualization is another approach that researchers have studied extensively to discover patterns and make clusters amongst traffic accidents. In the research paper \hyperref[b4]{[5]}, authors Chen et al. state that "Data visualization is an efficient means to represent distributions and structures of datasets and reveal hidden patterns in the data. "\par
This project builds upon many of the approaches described above and draws a parallel with the model developed by You et al \hyperref[b3]{[4]} but is different in the sense that it involves not only the accident, and traffic data but also the detailed demographics of the driver and the vehicle involved. 
\section[{III.}]{III.} 
\section[{Secondary Data}]{Secondary Data}\par
I obtained the data for accidents from the government of the UK website \hyperref[b1]{[2]}. Statistics on road safety in Great Britain are based on accidents reported to the police in a form submitted by the attending officer.\par
To quantize the accident severity, many factors were considered. One of the significant variables for this model was the volume of traffic flowing on the road at the accident time. Taner J.C. \hyperref[b5]{[6]} explained that the traffic volume and crash data follows the model Y = ?F?, 
\section[{A}]{A}\par
Author: Birkbeck University, London. e-mail: Harshita.garg@hotmail.com where Y is crash count, F is traffic volume, and ? and ? are calibration coefficients. In other words, the crash count is directly proportional to the amount of traffic on the road. Annual average daily flow(AADF) data is available on the government of the UK website \hyperref[b6]{[7]}. This dataset gives the estimated annual average of the flow of traffic on most of the major and minor UK roads.\par
The data for the vehicles involved in road accidents is from the same source as the accidents dataset \hyperref[b1]{[2]}. Vehicles dataset includes the details of the vehicles involved in accidents.\par
IV. 
\section[{Methodology a) Data Preparation}]{Methodology a) Data Preparation}\par
Many columns in the dataset had missing values. Columns with more than 20\% missing values were dropped. We also decided to drop the features that were not considered important in the classification problem at hand. After combining the Accident dataset with vehicles and the AADF table, many records for AADF were found to have missing values. The missing data was because not all the accident spots had AADF values available. This trend was more common in the minor roads, mainly B, C, and U roads. The final data frame had nearly 50\% of values missing.\par
We created a linear regression model to calculate the value of traffic based on the variable's latitude, longitude, road class, and road type. All the records with a valid AADF value in the combined data frame were used as the training dataset, and all the records with missing AADF values were used as a test dataset. Performance of the model was about 70\%, which was okay.\par
The machine learning models try to derive a meaningful relationship between the features present and the target variable. The ability of a model to predict the outcome successfully depends mainly on the types of features present in the dataset. This is where feature engineering comes into the picture. We engineered different features from the existing ones to increase the predictive powers of the models. We converted Hour of the day into a cyclic feature such that hour 0 is closer to hour 24. Data distribution after conversion of time into cyclic feature is plotted below. Mean encoding is encoding categorical features based on the ratio of occurrence of positive class in the target variable. For the problem at hand, the target variable is Accident Severity, and the positive class is the 'fatal' class. Thus, we converted the categorical variable 'road name' to mean encoded value which better represented the target variable accident severity. Two problems were solved here in one go -categorical variable with an unmanageable number of levels was converted to a quantitative one, and the target values were embodied into the feature, thus increasing the predictive power of the model. 
\section[{b) Exploratory Data Analysis}]{b) Exploratory Data Analysis}\par
A layered analysis was done for the exploratory variables to fully understand the dataset and the impact every variable had on the severity of accidents. We plotted the distribution of the number of accidents concerning some predictor variables and accident severity. The first graphs show that more accidents tend to happen on the weekdays rather than on the weekends. A maximum number of accidents seem to take place on day 6(Fridays). The third plot shows that most accidents happen on road type 6, which stands for single carriageway. According to the last graph, most accidents happen at junction 0(not a junction) and 3(T or staggered junction).\par
The second plot indicates that maximum accidents occur on A roads, followed by the unclassified 'U' category roads. Also, the maximum number of fatal accidents happen on the A roads.\par
We can identify accident hotspots by doing the geospatial analysis of accidents data. A number of accidents was plotted on the UK map based on their location information, and we obtained the following plot.  The above plot shows that the ratio of pedal cycle, two-wheelers and buses and coaches is centered more towards 0, suggesting that there are fewer roads that have a high distribution of these vehicles on average. The distribution of ratios for large goods vehicles(LGVs) is between 0 to 0.3, and that for heavy goods vehicles (HGV) is between 0 and 0.2. We get the maximum ratio for the cars and taxis(between 0.6 to 1.0), which is the trend that one would typically expect on any UK road.\par
We visualized the distribution of accidentseverity concerning the age and sex of the driver available in the vehicle dataset. Here 1(green) represents male drivers, 2(blue) represents female drivers, and 3 is unknown gender. This graph clearly shows that male drivers are more likely to be involved in motor accidents than female drivers. The graph peaks at the age band 6, which represents the age range 26-35 years, showing that this age range is more likely to be involved in accidents than the other age bands. 
\section[{c) Modeling}]{c) Modeling}\par
After the exploratory analysis of the dataset, some models were created in Python and evaluated for their performance. Before starting the modeling process though, some important decisions were taken. 
\section[{Choice of Metric:}]{Choice of Metric:}\par
A classifier is only as good as the metric used to evaluate it. A wrong metric misleads into believing that the classifier is working fine. Standard performance metrics treat all the classes in a multiclass problem as equally important. Whereas, in imbalanced classification problems, minority classes are often more important than the majority classes.\par
Following the general guidelines given by Jason Brown in his book \hyperref[b7]{[8]}, we decided to use F2-measure as a metric for model evaluation. In this case, False Negatives are more costly than False Positives. Meaning that if there is a likelihood of an accident happening at some location and we reported as negative (False Negative), it could be dangerous. On the other hand, if there is less probability of accidents happening and is flagged as an accident (False Positive), it was okay because it would warn the driver to be more cautious while driving. We calculated F2 measure as Generalization of F-beta score is calculated with the value of beta being equal to 2. Beta value 2 means that more emphasis is given on Recall than Precision.\par
Spot Checking the Algorithms: Spot-checking machine learning algorithms means evaluating a suite of different machine learning algorithms with minimum hyper tuning. Thus, giving each algorithm a fair chance to perform under comparable conditions. Spot-checking helps us decide which algorithms to use for the final model. We used the following framework for spotchecking: -Linear Algorithms: We checked the following linear algorithms. 
\section[{? Logistic Regression}]{? Logistic Regression}\par
? Linear Discriminant Analysis ? Naïve Bayes Non-Linear Algorithms: Nonlinear algorithms tend to perform better when the problem is inherently non-linear. 
\section[{? Decision Trees}]{? Decision Trees}\par
? Support Vector Classifier Ensembles: Ensembles are the group of algorithms, whose predictions are combined to give a better performance. Models tested here were:-? Random Forest ? Bagging ? Adaboost Sampling: Sampling is the process that attempts to reduce the class imbalance by decreasing the number of samples in the majority class(also called undersampling) or by increasing the number of samples in the minority class(also known as over-sampling). Cost-sensitive learning: Normal algorithms treat all the classes as equal. We can change this trend by enforcing cost-sensitive learning, in which we applied a cost to penalize the model if it does not predict the minority class correctly.\par
V. 
\section[{Model Evaluation and Testing a) Linear and Non-linear Models}]{Model Evaluation and Testing a) Linear and Non-linear Models}\par
All the linear, non-linear, and ensemble models were trained on the training set using the 10-fold crossvalidation method. The models were beyond the computing capacity of the laptop they were training on. Hence we decided to do the training on the cloud "floydhub". Floydhub is an extremely easy to use and intuitive platform for running python scripts on the cloud. We then recorded the average of the F2-scores and standard deviation.   After comparing the Precision and Recall values and the overall weighted f2-score,we decided to investigate the final four models further -Linear Regression, Naïve Bayes, Random Forest, and Adaboost. 
\section[{b) Sampling Methods}]{b) Sampling Methods}\par
The distribution of observations across different classes ( accidents severity):-1 2 3 3382 41947 231842 The above table showed that the data distribution was highly skewed amongst the three classes with the 83\% of the total accidents belonging to class 3(mild), nearly 16\% belonging to class 2(serious) only 1\% of the accidents belonging to class 3 that represents the fatal accidents.\par
Most machine learning algorithms are designed such that they perform the best if trained on the problems with equal class distribution throughout the dataset. When this is not the case, models learn to conclude that very few minority class instances exist. Hence, they are not critical and can be ignored. But this is far from true.\par
For this project, we investigated under-sampling methods and the combination of under-sampling and over-sampling method. In the combination method, we oversampled Class 1 using SMOTE(Synthetic Minority Over Sampling Technique) by the ratio of 4. The other two classes were under-sampled using random undersampling. The ratio of the three classes 1:2:3 was 4:0.8:0.4. In this technique, the number of samples of minority class was increased, and that of majority class was decreased, while maintaining the imbalance, thus training the model on more realistic data.\par
After the sampling, we trained the four bestperforming models on this data and tabulated their results. Sometimes the training error gives optimistic results, but the model does not perform well on the test dataset. Hence we also tested these models on the test set, and included their F2 scores in the table.  
\section[{c) Merging two classes}]{c) Merging two classes}\par
The classification problem that we were trying to solve here is a multiclass classification with three classes-Fatal, Serious, and Mild. For the accident dataset, accidents that involved deaths were defined as fatal accidents and accidents that involved a serious injury to the driver or passengers were classified as severe accidents. From a driver's point of view, whether he gets a red warning for a fatal accident or an amber alert for a severe accident, it should not make much of a difference. Moreover, in the multiclass classification models trained above, we saw that most of the classifiers ignored class 2. And for class 2, the recall value was relatively low in most of the models examined.\par
One way to deal with this problem was by combining the classes fatal and severe. The multiclassification problem now became a binary classification problem with two classes minority(serious + fatal) and majority(mild).\par
We then trained the best performing algorithms, chosen earlier on the data with two classes and we plotted their performance in following box and whisker plot.  
\section[{Conclusion}]{Conclusion}\par
This project attempted to identify the key factors responsible for motor accidents happening across the UK and created models to correctly classify the accidents by their severity level. The historical records of accidents datasets were analyzed to understand the trends and to see if any critical factors could be identified while classifying accidents into 3 different classes-Mild, Serious, and Fatal. Different types of predictor variables were analyzed concerning the frequency of accidents. The variables included temporal variables like time of the day, month etc. A strong correlation was found between the time of the day and the number of accidents.\par
Geo-spatial factors were studied to see if they contribute to the severity of the accidents. A graph between the road class and accident severity revealed that the maximum number of accidents happen on Aclass roads and not on the motorways, where the speed limit is usually more. Weather data, which was initially thought to be an important contributor in accidents, surprisingly did not emerge as a critical factor. More than 80\% of the accidents happen on bright days with no heavy rains/ snow.\par
Coming to the question -' What are the key factors responsible for accidents?' On examining the feature importance of our chosen random forest model, the following plot was obtained. From the features point of view, the geographical position is an essential feature in determining the accident probability. The latitude and longitude values were used to find the accident hotspots across the UK. The traffic flow data was the third most crucial feature in classifying accidents. Some of the engineered features proved to be particularly important from a classification point of view. Time features like month; day of the week proved to be important as well.\par
Accident prediction is inherently a difficult problem to solve and this project is a small step forward in facilitating progress on the same. With the systematic approach presented here, we introduced a model that gave promising results and classified accidents with an excellent f2 score estimate and a good recall score for the accident class. With more time, it would be a good idea to explore other possibilities for the ensembles in modeling the data. Ensembles generally tend to perform better than the individual classifiers. A warning system could be developed to warn the drivers in real-time using the model developed here.\begin{figure}[htbp]
\noindent\textbf{1}\includegraphics[]{image-2.png}
\caption{\label{fig_0}Figure 1 :}\end{figure}
 \begin{figure}[htbp]
\noindent\textbf{2}\includegraphics[]{image-3.png}
\caption{\label{fig_1}Figure 2 :}\end{figure}
 \begin{figure}[htbp]
\noindent\textbf{3}\includegraphics[]{image-4.png}
\caption{\label{fig_2}Figure 3 :}\end{figure}
 \begin{figure}[htbp]
\noindent\textbf{4}\includegraphics[]{image-5.png}
\caption{\label{fig_3}Figure 4 :}\end{figure}
 \begin{figure}[htbp]
\noindent\textbf{5}\includegraphics[]{image-6.png}
\caption{\label{fig_4}Figure 5 :}\end{figure}
 \begin{figure}[htbp]
\noindent\textbf{}\includegraphics[]{image-7.png}
\caption{\label{fig_5}}\end{figure}
 \begin{figure}[htbp]
\noindent\textbf{6}\includegraphics[]{image-8.png}
\caption{\label{fig_6}Figure 6 :}\end{figure}
 \begin{figure}[htbp]
\noindent\textbf{7}\includegraphics[]{image-9.png}
\caption{\label{fig_7}Figure 7 :}\end{figure}
  \begin{figure}[htbp]
\noindent\textbf{1} \par 
\begin{longtable}{P{0.45476190476190476\textwidth}P{0.14285714285714288\textwidth}P{0.16190476190476188\textwidth}P{0.09047619047619047\textwidth}}
Name of the Model\tabcellsep Average of f2 Scores\tabcellsep Standard Deviation of scores\tabcellsep Time taken\\
Linear Regression\tabcellsep 0.804\tabcellsep 0.000\tabcellsep 10s\\
Linear\tabcellsep \tabcellsep \tabcellsep \\
Discrminant\tabcellsep 0.801\tabcellsep 0.001\tabcellsep 5s\\
Analysis\tabcellsep \tabcellsep \tabcellsep \\
Naïve Bayes\tabcellsep 0.795\tabcellsep 0.001\tabcellsep 3s\\
Decision Tress\tabcellsep 0.804\tabcellsep 0.000\tabcellsep 5s\\
Linear SVC\tabcellsep 0.804\tabcellsep 0.000\tabcellsep 25s\\
Bag\tabcellsep 0.806\tabcellsep 0.000\tabcellsep 16m48s\\
Random Forest\tabcellsep 0.806\tabcellsep 0.000\tabcellsep 3m32s\\
Adaboost\tabcellsep 0.805\tabcellsep 0.000\tabcellsep 3m41s\\
\multicolumn{4}{l}{Performance of the above models was}\\
\multicolumn{3}{l}{compared using a box and whisker plot.}\tabcellsep \end{longtable} \par
 
\caption{\label{tab_0}Table 1 :}\end{figure}
 \begin{figure}[htbp]
\noindent\textbf{2} \par 
\begin{longtable}{P{0.3382943143812709\textwidth}P{0.19615384615384615\textwidth}P{0.16488294314381272\textwidth}P{0.15066889632107022\textwidth}}
Name of the model\tabcellsep Average of Training f2 scores\tabcellsep Standard deviation\tabcellsep Test F2 score\\
Under-sample LR\tabcellsep 0.788\tabcellsep 0.000\tabcellsep 0.804\\
SMOTE LR\tabcellsep 0.601\tabcellsep 0.000\tabcellsep 0.804\\
Under sample NB\tabcellsep 0.779\tabcellsep 0.001\tabcellsep 0.794\\
SMOTE NB\tabcellsep 0.608\tabcellsep 0.002\tabcellsep 0.778\\
Under sample RF\tabcellsep 0.791\tabcellsep 0.000\tabcellsep 0.804\\
SMOTE RF\tabcellsep 0.707\tabcellsep 0.003\tabcellsep 0.804\\
Under\tabcellsep \tabcellsep \tabcellsep \\
sample\tabcellsep 0.789\tabcellsep 0.000\tabcellsep 0.803\\
Adaboost\tabcellsep \tabcellsep \tabcellsep \\
SMOTE Adaboost\tabcellsep 0.683\tabcellsep 0.002\tabcellsep 0.802\end{longtable} \par
 
\caption{\label{tab_1}Table 2 :}\end{figure}
 		 		\backmatter  			  				\begin{bibitemlist}{1}
\bibitem[Chen et al. ()]{b4}\label{b4} 	 		\textit{A Survey of Traffic Data Visualization},  		 			Wei Chen 		,  		 			Fangzhou Guo 		,  		 			Fei-Yue Wang 		.  		 \url{https://ieeexplore.ieee.org/abstract/document/7120975}  		2010.  	 
\bibitem[Salifu ()]{b3}\label{b3} 	 		\textit{Accident Prediction Models for Unsignalised Urban Junctions in Ghana},  		 			Mohammed Salifu 		.  		 \url{https://core.ac.uk/download/pdf/82011865.pdf}  		2003.  	 
\bibitem[Tanner ()]{b5}\label{b5} 	 		\textit{Accidents at rural three-way junctions},  		 			J C Tanner 		.  		 P -56-67.  		1953.  	 	 (Journal of the Institution of Highway Engineers 2) 
\bibitem[Department For (2019)]{b6}\label{b6} 	 		\textit{GB Road Traffic Counts},  		 			Transport Department For 		.  		 \url{https://data.gov.uk/dataset/208c0e7b-353f-4e2d-8b7a-1a7118467acc/gb-road-traffic-counts}  		May 2019.  	 
\bibitem[Hartson (2016)]{b0}\label{b0} 	 		 			William Hartson 		.  		 \url{https://www.express.co.uk/life-style/top10facts/622407/Top-10-facts-road-safety}  		\textit{Top 10 facts about Road Safety},  				Feb, 2016.  	 
\bibitem[Brown ()]{b7}\label{b7} 	 		\textit{Imbalanced Classification with Python},  		 			Jason Brown 		.  		2017. p. .  	 
\bibitem[You et al. (2017)]{b2}\label{b2} 	 		\textit{Realtime crash prediction on freeway and emerging techniques},  		 			Jinning You 		,  		 			Junhua Wang 		,  		 			Jingqui Guo 		.  		 \url{https://www.researchgate.net/publication/316489169\textunderscore Real-time\textunderscore crash\textunderscore prediction\textunderscore on\textunderscore freeways\textunderscore using\textunderscore data\textunderscore mining\textunderscore and\textunderscore emerging\textunderscore techniques}  		April 2017.  	 	 (Journal of modern transportation) 
\bibitem[Department For (2019)]{b1}\label{b1} 	 		\textit{Road Safety Data},  		 			Transport Department For 		.  		 \url{https://data.gov.uk/dataset/cb7ae6f0-4be6-4935-9277-47e5ce24a11f/road-safety-data}  		December 2019.  	 
\end{bibitemlist}
 			 		 	 
\end{document}
