A New Spatio-Temporal Neural Network Approach for Traffic Accident Forecasting
Total Page:16
File Type:pdf, Size:1020Kb
UNIVERSIDAD NACIONAL DE EDUCACIÓN A DISTANCIA MASTER THESIS A New Spatio-Temporal Neural Network Approach for Traffic Accident Forecasting Author: Supervisor: Rodrigo de Medrano José Luis Aznarte López Mellado, PhD A thesis submitted in fulfillment of the requirements for the degree of MSc. Advanced Methods in Artificial Intelligence in the Departament of Artificial Intelligence September 13, 2019 ii UNIVERSIDAD NACIONAL DE EDUCACIÓN A DISTANCIA Abstract ETS de Ingeniería Informática Departament of Artificial Intelligence MSc. Advanced Methods in Artificial Intelligence A New Spatio-Temporal Neural Network Approach for Traffic Accident Forecasting by Rodrigo de Medrano López Traffic accidents forecasting represents a major priority for traffic govern- mental organisms around the world to ensure a decrease in life, property and economic losses. The increasing amounts of traffic accident data have been used to train machine learning predictors, although this is a challeng- ing task due to the relative rareness of accidents, inter-dependencies of traffic accidents both in time and space and high dependency on human behav- ior. Recently, deep learning techniques have shown significant prediction improvements over traditional models, but some difficulties and open ques- tions remain around their applicability, accuracy and ability to provide prac- tical information. This paper proposes a new spatio-temporal deep learning framework based on a latent model for simultaneously predicting the num- ber of traffic accidents in each neighborhood in Madrid, Spain, over varying training and prediction time horizons. iii Acknowledgements Cuando uno se embarca en la realización de un trabajo de este calibre, se puede tener por seguro que el camino no será fácil. Por eso, y sin desestimar el trabajo propio que haga cada uno, es imprescindible rodearse de personas que estén dispuestas a remar en la misma dirección que uno mismo. Por ello, me gustaría agradecer especialmente la labor, apoyo y sobre todo confianza que el Dr. José Luis Aznarte ha depositado en mí desde el princi- pio. Sin duda, este trabajo no habría sido posible sin su tutela. Igualmente a mi familia, Irene y amigos, quienes al final son los que están tanto en las buenas como en las malas en el día a día. Siempre habéis sabido ser el apoyo que quizás no merecía, pero sí que necesitaba. iv Contents Abstract ii Acknowledgements iii 1 Introduction1 1.1 Presentation.............................1 1.2 Motivation..............................2 1.3 Previous work............................3 1.4 Objectives..............................3 1.5 Problem formulation........................4 1.6 Thesis overview...........................4 2 Data analysis and description5 2.1 Data presentation..........................5 2.2 Data cleaning............................7 2.3 Data analysis.............................8 2.3.1 Time series study......................9 2.3.2 Spatial series study..................... 12 2.3.3 Relations between datasets................ 12 3 Models for spatio-temporal series regression 15 3.1 Notation............................... 15 3.2 The STNN model.......................... 15 3.2.1 The main idea........................ 15 3.2.2 Application to spatio-temporal series.......... 16 3.3 The XSTNN model......................... 18 3.3.1 Limitations......................... 19 3.4 Other models............................ 20 3.4.1 Mean............................. 20 3.4.2 Persistence.......................... 20 3.4.3 Linear regression...................... 20 3.4.4 XGBoost........................... 21 4 Experimental settings 22 4.1 Introduction, purpose and organization............. 22 4.2 Validation.............................. 23 4.2.1 Setup for the experiments................. 24 4.3 Hyper-parametrization and parameter tuning......... 25 4.4 Spatial relations........................... 26 v 5 Results and discussion 28 5.1 General results............................ 28 5.2 Reasoning in an spatio-temporal dimension........... 29 5.3 Spatial dependency......................... 31 5.4 Feature importance......................... 32 5.5 Reproducibility........................... 33 6 Conclusions, contributions, future research and ethical aspects 34 6.1 Ethical aspects............................ 35 A Madrid neighborhoods 36 Bibliography 40 vi List of Figures 2.1 Two mesh grid choices for a spatial problem in the city of Madrid.................................7 2.2 Total number of accidents for each timestep in Madrid.....9 2.3 Periodicities of the traffic accidents series. (a) Number of acci- dents depending on day of the week. Weekends present less number of accidents. (b) Number of accidents for each month. August seems to be safer. (c) Number of accidents depending on hour of the day. In this case we have the most clear difference. 10 2.4 Autocorrelation of the time series associated to traffic accidents in Madrid............................... 11 2.5 Total number of accidents by district of Madrid......... 12 2.6 Total number of accidents by neighborhoods of Madrid..... 13 2.7 Correlation diagram of traffic accidents respect to exogenous variables................................ 13 2.8 Periodicities of the traffic series................... 14 3.1 Architecture of the STNN model as described in Section 3.2.2. 17 3.2 Architecture of the XSTNN model as described in Section 3.3. 19 4.1 An example of rolling origin cross-validation for time series. Blue dots represent the train set, whereas red dots show the test set. Figure from [7]....................... 24 4.2 Spatial relations used during the experiments. Representation of matrix W.............................. 27 5.1 Forecasting performance (MAE and bias) of the different mod- els by timestep together with the calculated distributions.... 29 5.2 A practical example of the operation of both networks, XSTNN and STNN, for a same situation. From 17 p.m. to 21 p.m. on a Wednesday.............................. 30 5.3 A practical example of the operation of both networks, XSTNN and STNN, for a same situation. From 6 a.m. to 10 a.m. on a Sunday................................. 31 5.4 Spacial risk in the same scale for the ground truth (left) and the XSTNN (right).......................... 32 5.5 Feature contribution by type of data................ 33 vii List of Tables 2.1 Scheme of the final-cleaned dataset used in this project.....8 2.2 Dataset statistics before reescaling................9 2.3 Dataset statistics after reescaling.................9 4.1 Values tested for each hyper-parameter. nz is the dimension of the latent space. The remaining variables were presented in Chapter3 or are commonly used parameters........... 25 4.2 Values chosen for each hyper-parameter.............. 26 5.1 Performance for T + 1 to T + 5 traffic accident regression.... 28 1 Chapter 1 Introduction Through this first chapter, a general vision of the problem will be of- fered and its importance will be highlighted. Objectives and previous research on the topic are also discussed. At the end, there is a brief overview of the thesis. 1.1 Presentation Nowadays, the urbanization trend around the globe has introduced new op- portunities and issues in the cities. One of the most important aspects of the modern society is related to the use of motorized vehicles as a method of transport. Although very efficient in several ways [13], motor vehicles imply problems related to traffic and health care. For example, pollution and traffic accidents are some of the principal causes of death in cities all over the world [8, 28]. This is the reason why the scientific interest for traffic accidents has in- creased in the past decades, and proposing solutions is a crucial issue for the sake of improving transportation and public safety. Being capable of under- standing and reducing accidents has become an important commit in many cities, as they not only cause significant life losses, but also property and eco- nomic ones [21]. In this work, an effort will be put to study the traffic accident phenomenon in the city of Madrid. This has been the subject of several lines of research in the past, although most previous studies on traffic accident prediction con- ducted by domain researchers simply applied classical prediction models on limited data without addressing many challenges properly, thus leading to unsatisfactory performances. For instance, the imbalanced severity classes, non-linear relationship between dependent and independent variables or spatial heterogeneity are usual problems to deal with in order to improve previous results in the field. In addition, traffic accidents show a potential problem when using quantitative methodologies for their prediction: there is a great dependence between accidents and human behaviour, being distrac- tions or merely human actions cause of almost 60% of deadly traffic accidents in Spain [10] (and even a larger percentage for non-deadly accidents). Although predicting the exact space-temporal position of accidents is out of the scope with actual techniques due to its complexity [17, 34], much progress might be done by characterizing important parts of the problem. 2 Chapter 1. Introduction Trying to reduce the dimensionality of the space as much as possible, discov- ering relevant features or improving previous models are some examples of what can be done to provide insight in this particular problem. In this context, this work presents the problem as a spatio-temporal series in which traffic intensity and meteorological variables play a central rol in