Full text
i A Data Mining Approach to Predict urban Fires in Lisbon using H2o.ai python Library Luis António Hill Quinta (M20190067) Project Work presented as partial requirement for obtaining the Master’s degree in Information Management
i
ii NOVA Information Management School Instituto Superior de Estatística e Gestão de Informação Universidade Nova de Lisboa A DATA MINING APPROACH TO PREDICT URBAN FIRES IN LISBON USING H2O.AI PYTHON LIBRARY by Luis Antonio Hill Quinta Project Work presented as partial requirement for obtaining the Master’s degree in Information Management/ Master’s degree in Statistics and Information Management , with a specialization in Business Intelligence and Knowledge Management. Advisor / Co Advisor: Miguel de Castro Neto
iii November 2021 ACKNOWLEDGEMENTS I would like to thank my advisor, Miguel Castro e Neto and the Department of Urban Analytics at Nova IMS, for the help and guidance throughout this thesis project. I would also like to thank all my family and friends for supporting me and motivating me to achieve my goals throughout my thesis and my master’s degree.
iv ABSTRACT Technologies have enabled societies to socially and economically prosper and to be more interconnected. With the decreasing cost of data storage and processing, cities are now trying to extract actionable information from the available data to improve and optimize their resource allocation and planning. This thesis aims to develop a data-mining approach to predicting urban fires in Lisbon, leveraging both climate, building, and population data available to predict where a fire will happen in the future within a particular period. To aid RSB in reducing their overall response time to fires by predicting probable positive emergency event areas and understand the driving factors that lead to these events in Lisbon. This supervised learning task developed using the CRISP-DM methodology makes use of standard machine learning estimators using the h2o.ai python module to incorporate parallel distributed computing combined with an AutoML package, evaluated using cross-validation, PR-AUC and F-0.5 score. The main conclusion from this paper is that applying predictive methods of data mining in the prediction of emergency events has a large potential to aid in resource allocation and understanding of drivers to combat emergency events, however requires large amounts of data to for algorithms to learn and extract actionable insights from their predictions. KEYWORDS Lisbon; Emergency Incident Prediction; Urban Fires; Predictive Modelling; H2oai;
v INDEX 1. Introduction .................................................................................................................. 1 1.1. Background ............................................................................................................ 1 1.2. Data Mining in City Management ......................................................................... 2 2. Literature review .......................................................................................................... 3 2.1. Wildfire prediction Models: .................................................................................. 3 2.2. Property Level Urban Fire Prediction .................................................................... 3 2.3. Community Level Urban Fire Prediction ............................................................... 4 2.4. Optimization of firefighter response in lisbon with predictive analytics .............. 5 2.5. Spatial & Temporal Resolutions: ........................................................................... 5 2.6. Feature Selection: .................................................................................................. 6 2.7. Models: .................................................................................................................. 6 2.7.1. H2o.ai.............................................................................................................. 7 2.8. Model evaluation: ................................................................................................. 7 2.8.1. Evaluation Metrics: ......................................................................................... 7 3. Methodology ................................................................................................................ 9 3.1. Business Understanding ...................................................................................... 10 3.2. Data Understanding ............................................................................................ 10 3.2.1. Event Dataset ............................................................................................... 11 3.2.2. Weather Dataset .......................................................................................... 12 3.2.3. Census Dataset ............................................................................................. 13 3.3. Data Preparation ................................................................................................. 14 3.3.1. Data Cleaning................................................................................................ 14 3.3.2. Data Integration ........................................................................................... 15 3.3.3. Data Pre-processing ..................................................................................... 18 3.4. Modelling ............................................................................................................. 19 3.4.1. Train test split ............................................................................................... 19 3.4.2. Auto ML ........................................................................................................ 20 3.4.3. Hyperparameter Tuning ............................................................................... 20 4. Results and discussion ................................................................................................ 22 4.1.1. Variable Importance ..................................................................................... 25 4.1.2. Output .......................................................................................................... 26 5. Conclusions ................................................................................................................. 27 6. Limitations and recommendations for future works ................................................. 28
vi 6.1. Limitations ........................................................................................................... 28 6.1.1. Weather Data Limitations ............................................................................ 28 6.1.2. Census Limitations ........................................................................................ 28 6.2. Future Works ....................................................................................................... 28 6.2.1. Predicting other emergency events. ............................................................ 29 7. Bibliography ................................................................................................................ 30 8. Appendix (optional) .................................................................................................... 34 8.1. Appendix 1: Table showing Breakdown of daily periods .................................... 34 8.2. Appendix 2: Pair correlations and the removed variables: ................................. 34
vii LIST OF FIGURES Figure 1 – Phases of the CRISP-DM reference model Figure 2 - Distribution of event types Figure 3 - Emergency events count per year Figure 4 - Average temperature per year per target Figure 5 - Average humidity per year per target Figure 6 - Count of fires per season Figure 7 - Count of fires per period Figure 8 - Average temperature per season per year per target Figure 9 - Count of fires per Area Figure 10 - Count of fires per number of residents Figure 11 - Diagram showing the potential breakdown of spatial and temporal resolutions. Figure 12 - Oalley Map, showing 5min radius from largest parishes in Lisbon Figure 13 - Map of Fireman Incidents locations in largest parishes in Lisbon Figure 14 - Diagram showing the selection from hierarchy levels of datasets and cross joining data frames Figure 15 – K-fold cross validation Diagram Figure 16 - AutoML Leader board Figure 17- AutoML best model train set results Figure 18 - AutoML best model cross validation results Figure 19 - AutoML Selected model characteristics Figure 20 - GBM grid search hyperparameters Figure 21 - Baseline to actual comparison table Figure 22 - Grid search results on test data Figure 23 - Top 10 variables ranked by variable importance
viii LIST OF ABBREVIATIONS AND ACRONYMS CML - Câmara Municipal de Lisboa (Lisbon’s Municipality) INE - Instituto Nacional de Estatística (National Institute of Statistics) IPMA - Instituto Português do Mar e da Atmosfera (Portuguese Weather Institute) RSB - Regimento Sapador de Bombeiros (Lisbon’s Municipal Firefighters) LIMP - Lisbon Intelligent Management Platform (PGIL) VUCI - Veículo de Combate a Incêncio Urbano (Vehicle to Fight Urban Fires) ICT – Information Communication technologies IoT – Internet of Things CRISP-DM – Cross Industry Standard Process for Data-Mining SVM – Support Vector Machines RF – Random Forest PR-AUC – Area-under precision-recall curve AutoML – Automatic Machine Learning AUC – Area-under curve
7 other deep learning algorithms have also been used in the prediction of emergency events within cities, most studies indicate that deep learning is more effective with datasets that contain a large number of positive cases (Bao, Liu, & Ukkusuri, 2019). 2.7.1. H2o.ai H2o is an open-source application that is used for machine learning. The python module of H2o has functions that automate much of the training and evaluation of supervised machine learning problems, and increase transparency of models. The use of h2o has not been extensive in the prediction of emergency events. However, this technology has become a leading tool in the development and deployment of many machine learning models. The ease of connection to a cluster and the simple scalability into distributed computing without extra code, whilst having functions such as AutoML, that run multiple estimators and ensembles in a standardized way has made h2o the preferred tool for many data scientists (Devisschere, 2021). The H2o.ai platform is also a preferred tool due to the APIs offered for users to integrate with other technologies. 2.8. MODEL EVALUATION: In the analysed models, a majority of the analysed studies use random cross-validation methods to assess the model performance. Nevertheless, some frame their models as a time series problem where cross-validation is not random. Framing the task as a time series implies that events and features are dependants on time, and therefore the best approach to test if a model will be able to deal well with future data is to check if past data can predict future data. When it comes to model selection and evaluation, cross-validation ensures the model scores are consistent against unseen data (Brownlee, 2020). A report which analyses different crossvalidation techniques for various parametric models provided a greater insight into the benefits and disadvantages of each type of split for cross-validation. The general approach was to test random versus block split; block split refers to applying cross-validation with the dependant variables. The main conclusion of this study was that block-split cross-validation can cause bias in the model due to the user selection of blocks, but when properly selected the results to tend to be closer to the true performance of a model against unseen data compared with Random split. Random split is the preferred cross-validation technique when the user is not very familiar with the data. 2.8.1. Evaluation Metrics: Due to this project's nature and the negative implications of a poorly accurate model, it is essential to consider the metrics chosen to evaluate model performance. Based on most studies analysed, emergency incident prediction, datasets tend to be severely imbalanced, where positive
8 events have a one to one hundred ratio to negative events. Therefore common classification metrics such as accuracy and precision can be misleading about the actual performance of the model (Haixiang, et al., 2017). When considering the business case at hand, the weighting of false positives and false negatives is different, depending on the model's application. For optimizing fire inspections, it is essential to prioritize classifying the positive class rather than minimizing false positives because false negatives would result in no inspection and, therefore, adverse outcomes (Walia, et al., 2018), while false positives result in inspections that have no adverse outcome. On the other hand, if a model is used to optimize resource allocation (which is the case for this model), then false positives will allocate resources where no event takes place, and if resources are scarce, this will have an adverse outcome on the business. A commonly used metric to evaluate imbalanced models is the and area-under-receiving operating curve ("AUROC"), where the relationship between specificity (True negative rate) and sensitivity (true positive rate), at different threshold levels is plotted (Narkhede, 2018). However, AUROC weights false positives and false negatives equally, therefore depending on the problem at hand, AUROC can also be misleading. To evaluate the model taking into consideration the business case to focus primarily on improving true positives and reducing false positives, 2 metrics are used; Area under the precisionrecall curve (‘PR-AUC’) and F0.5 score. The precision-recall curve (‘PRC’) shows the ratio between precision and recall for different threshold levels (Pedregosa, Varoquaux, Gramfort, & Michel, 2011). The main difference between the PRC and the ROC is that precision-recall curves do not consider true negatives, which helps understanding how well the model predicts the positive events (Ekelund, 2017). Unlike the AUC ROC curve where the baseline used to compare any model is 0.5, the PR-AUC curve’s baseline has to be calculated based on the number of samples tested. F0.5-score is also seen as a critical metric when dealing with severe imbalance data in emergency incident prediction. The F1-score places equal importance on both precision and recall, but changing the beta from 1 to 0.5, places higher importance on precision and less to recall resulting in a better understanding of how the model predicts positive events (Brownlee, A Gentle Introduction to the Fbeta-Measure for Machine Learning, 2020).
9 3. METHODOLOGY The methodology that will be used for this data mining model is the 'Cross Industry Standard Process for Data-Mining' (known as CRISP-DM). This is one of the most widely used methodologies in data mining (Brown, 2015). This process was developed in 1999 with funding from the European Union to develop a universal process for data mining. The main concept of the CRISP-DM structure is the development of a model through 6 phases (Chapman, Clinton, Kerber, Khabaza, & Reinartz, 2000). Beginning with the business understanding where the developer identifies the business goals defined before the development of the model. It is important to consider that the business goals are always subject to changes as time progresses and therefore a robust model needs to account for potential changes in the overall projected applications of the model. The second phase of the process is understanding the data. This refers to the discovery of the raw data and conducting exploratory data analysis to define whether the available data is relevant for the model and if more data is required for analysis. The third phase refers to the preparation of the data for modelling, this includes cleaning (missing variables, outlier treatment), feature selection & engineering, and integrating data sources. It is important to consider the modelling stage ahead since some models benefit from extra steps in the data preparation stage such as feature scaling for linear machine learning algorithms (Roy, 2020). The fourth phase of the process is the modelling section where the data is split into training and testing samples, machine learning models are selected and fine-tuned to train the data, and the model is built and run. The fifth phase of the process is the evaluation of the results generated from the models and whether these answer the business goals. These results always have to be put into context since depending on the mining goal some metrics are more relevant than others. The final phase of the CRISP-DM methodology process is the deployment of the model, where the model is documented, reviewed, and actionable information is extracted or the model is put into a repeatable mining process. The following section describes the CRISP-DM process of the model completed for this thesis.
10 3.1. BUSINESS UNDERSTANDING RSB currently responds to over five thousand emergency incidents per year in the city of Lisbon, of which 25% are fires. This paper, however, focuses on predicting fires in the city of Lisbon. Despite there being some seasonality to fires around Lisbon, there is currently no system to help predict where or when fires will happen. Firefighters rely on their intuition and expertise to manage their resources. Based on the evidence found on the importance of a rapid response time to reduce the severity of an emergency event, the main goal for this model is to be able to reduce the response time to emergency events to within five to ten minutes. To achieve this response time, firefighters need to understand which areas are at greater risk of a fire constantly to allocate first response emergency vehicles (VUCI) to high-risk areas. The concept of the model will be to predict where and when fires will take place. However, the model is designed not specifically for fires, but for all types of emergency, events responded to by RSB. Fires have been chosen as the preferred emergency type to predict, due to the negative externalities caused by fires compared with other emergency events. Fires as an emergency event have a sporadic nature, and therefore models which can predict complex events, will in theory perform well on less complex emergency events, such as floods. 3.2. DATA UNDERSTANDING The available data comprises three separate datasets. The first dataset is the Historical log of incidents between 2013-2018 provided by the RSB of Lisbon. The second dataset is provided by the national institute of sea and atmosphere with weather recordings from 3 different stations around Lisbon for the same period. The third dataset is the census data aggregated at the census block level provided by the Portuguese national institute of statistics. In this section a further description of each dataset and the connection to the target variable.
11 3.2.1. Event Dataset • 67,656 rows relating to all events (emergency & non-emergency) responded by the RSB Fireman in Lisbon, between the dates of 01-08-2013 to 31-12-2018. • 9 columns, relating to time, date, and location of event, type of event (i.e. Fire, Flood, Road Accident, etc..), and relevant ID’s. The above figures show the distribution of event types responded by RSB. For this model, we disregard the ‘Low severity’ as an event type, since RSB operates differently for non-emergency events. From the yearly distribution, we can visualize how events alter throughout the years. For the case of fires, these are decreasing year on year, however, the opposite occurs in car accidents. It doesn’t necessarily mean that there are more car accidents in general only that there are more car accidents where RSB responded. For this study, the target variable will be chosen as fires (0 equals no event, 1 equals positive event). Figure 3: Emergency events count per year Figure 2: Distribution of event types
12 3.2.2. Weather Dataset The second dataset was provided by the Instituto Português do Mar e da Atmosfera, containing the hourly meteorological data between 2013 and 2018 across three different weather stations in Lisbon. • 156,652 rows where each row represents hourly timestamps (between 01-01-2013 to 31-12- 2018) for each of the 3 weather stations in Lisbon. • 56 columns, relating to weather indicators (i.e Humidity, Temperature, precipitation, etc..) and time characteristics (i.e. Day of the week, season, period of the day, etc..) To better understand if the available data has useful information to make predictions, we explore our variables to discover relationships between them and the target variable. Starting with the weather dataset, we can see from the charts above that our target variable has some seasonality to it. We can see that the target variable occurs more often in the summer, which can also be seen by the average temperature and humidity of positive and negative values. From this we can assume there is some sort of seasonality, this can be interpreted in two ways. The first is we can assume that high temperatures and low humidity levels cause fires to propagate faster and therefore cause positive events, or we can assume that for an unrelated reason there are more fires in summer, where coincidently temperatures are higher and humidity levels are lower. Figure 7: Count of fires per period Figure 6: Count of fires per season Figure 4: Average temperature per year per target Figure 5: Average humidity per year per target
13 When viewing temperature and humidity graphs per month-year, we find evidence that temperatures are on average higher and humidity levels are on average lower for positive events, independently of the season, suggesting that these features can be important in predicting a positive event. 3.2.3. Census Dataset The third dataset is the 2011 census survey, which includes a snapshot of 2011 building characteristics and population data within Lisbon and is grouped geographically into 3,551 subsections. The Census data consists of: • 3351 rows which are the 3351 census blocks at the lowest level of granularity. • 102 columns, which are the characteristics and demographics of each census block. These are broken down into: ➢ 9 Columns relating to IDs, coordinates, and associated weather stations. ➢ 56 Columns relating to population demographics (n. men & woman, n. residents w/ secondary education, etc..) ➢ 37 Columns relating to building demographics (n. classical buildings, n. concrete buildings, etc..) Since columns are highly correlated with each other, there won’t be a major shift between trends of predictive columns and the target variable. Within the aggregations, some census blocks are much larger in area than others and therefore have more buildings and larger population size, which in turn correspond to a higher number of positive events. Figure 9 below shows that as the area Figure 8: Average temperature per season per year per target (blue = no event, orange = positive event)
14 increases the number of positive events also increases however not exactly linearly. The same can be verified in figure 10, graphing the number of residents against the target variable. Since both figures above are almost identical, to better understand the relationship between these two variables and the target variable a new graph is created that combines both area and population into ‘Population Density (number of residents / Area of c-block), in an attempt to extract further insights. 3.3. DATA PREPARATION 3.3.1. Data Cleaning 3.3.1.1. Missing Values The data cleaning section of this model was initially done in a previous thesis using the same data sources (Teixeira, 2018). The only dataset that contained missing values was the IPMA dataset. As there are two other stations, the data was filled using the closest weather station data. In the case where all stations had missing data for the same period, then the averages of the previous and the next hour were inputted. In the case of wind direction, 0.5% of records were not recorded on either station and therefore the authors used a random forest algorithm to predict the missing values. There were no missing values for the census or the RSB historical dataset. 3.3.1.2. Multicollinearity To reduce a potential bias within the data, it is common practice to remove features with high multicollinearity. Within the weather data, for each meteorological measurement (humidity, temperature, wind speed, etc..), there are three features, the instant recording, the one hour & two hour average of the indicator measurement. These columns are very highly correlated with each other, so we chose to remove the instant and the 2hr measurement, leaving only the 1hr average. Figure 9: Count of fires per Area Figure 10: Count of fires per number of residents
15 Within the census data, many features are highly correlated to other features. Some features overlap and double count the statistics. (i.e., n.Residents aged 20_65 & n.Residents aged 25_65), Other columns are highly correlated with other features, (such as students attending secondary education vs n.Residents aged 14_20. The treatment of multicollinearity between features will be the same as in the previous study where Pearson's correlation coefficient is greater than 0.8 were removed from the dataset, a full list of the included/removed features is in appendix 3. 3.3.2. Data Integration 3.3.2.1. Geospatial interpolation To combine the weather dataset with the census dataset, a weather station was assigned to each of the 3,351 subsections of the census. This was done using simple interpolation using ArcGis based on the shortest Euclidean distance between the weather station and subsection. No topography was taken into consideration in this interpolation. 3.3.2.2. Spatial-Temporal Resolutions Based on the analysed literature, it is essential to create the right balance between spatial and temporal discretization but also to consider the implications that changing resolutions and granularity of the data might have on the model and real-world application. Larger datasets might require undersampling or dimensionality reduction to predict efficiently; however, increasing the resolution of the data can also create bias and cause overfitting. (Mukhopadhyay, et al., 2020) For the weather data, to reduce the size of our dataset, we have decided to rather than use hourly meteorological data, we aggregate a day into six blocks of four hours each (see appendix 1). The main reason for this is that when put into context the application of this model, firefighters tend to work in shifts of four hours. When considering future predictions the data that is being used will be IPMA forecasted weather, which itself contains a predictive error, rather than the actuals used for training the model. Therefore using 4-hour averages reduces the potential error that these forecasts might have. Since weather indicators are already one-hour averages, the aggregating function will be to take the mean values of indicators within the blocks. This reduces our weather dataset by 75% from 52,584 to 13,149 rows. In terms of the census data, there are three possible aggregations, 3351 streets, 1063 municipalities, or 55 parishes.
16 Figure 11 shows the potential space and time combinations that could be tested for the available dataset. When defining the optimal breakdowns of the spatial resolution, it is vital to consider the performance and the computational time of the model. It is also important that the spatial resolution breakdown is still relevant to solve the problem at hand. For the particular case of this study, the main objective is to reduce the first response vehicle travel time to five minutes. Therefore, for the lowest spatial resolution available, which corresponds to the 55 parishes of Lisbon, we created an interactive map that creates a five-minute radius for the ten largest parishes in terms of area (km2) and when compared to the radius to the coordinates of the historical fire log to check if any emergency event lied outside the 5minute radius. All events were captured within the ranges of the five-minute drive, which means that using the lowest census special resolution would still be useful when considering the problem at hand. For this methodology, we assume that the spatial resolution used will be 55 location blocks, and the temporal resolution used is 10,950 periods (5years, 365 days, six 4-hour blocks). These resolutions were chosen because they are the optimal resolutions where predictions are most useful for RSB. Figure 11: Diagram showing the potential breakdown of spatial and temporal resolutions. Figure 12 Oalley Map, showing 5min radius from largest parishes Figure 13 Map of Fireman Incidents locations in largest parishes
23 The results show that overall the best performing estimator on the training set with the problem is the Gradient Boosting Machine. To check for overfitting, the results of cross-validation are also analysed to determine if there is a large discrepancy between train set metrics and crossvalidation metrics. With cross-validation, sample sizes of each fold can vary, and therefore a baseline PR-AUC is not calculated for each fold, however, it is assumed that the proportion of positive target events is similar across all folds, and therefore the baseline PR-AUC for the training will also be considered for the cross-validation. The optimal model from the AutoML function is described as following Using the information obtained from the optimal model summary, there is a better understanding of which values should be used in the grid search when fine-tuning the model. The Figure 20 shows the hyperparameters selected in the grid search for the gradient boosting machine estimator of the h2o module. 216 combinations were selected to be tested. Specifically the ‘max dept’ levels to reduce computation and reduce potential overfitting, ’column sample rate’ and ‘sample rate’ which defines the ratio of columns and rows, this is mainly used for large datasets and finally the balancing of classes to deal with the severe imbalance of the dataset. Figure 17: AutoML best model train set results Figure 18: AutoML best model cross validation results Figure 19: AutoML Selected model characteristics Figure 20: GBM grid search hyperparameters
24 The optimal model based on the grid search, improved the PR-AUC of both the cross-validation and the test set, as seen in the figure below. The output from the grid search shows an improvement in all metrics against the test set compared with the AutoML run before the hyperparameter tuning. The best performing model, did not balance classes which means for this particular case that over or under sampling did not improve the chosen metrics. Comparing the above figures, it is clear that the models can improve on the baseline PR-AUC, however analysing the confusion matrix there are still a significant amount of false positives and false negatives, which is a practical approach that is not yet sufficient to use as a decision-making tool to effectively allocate resources since the potential cost of a false positive is very high. Nevertheless, it is important to consider that the false positive/ negative rate using this methodology is significantly lower compared to the methodology used in a previous paper using the same data sources. This Sample Baseline (PR-AUC) Best Model (PR-AUC) F-0.5 Score Cross-Validation 0.005 0.0169 0.042614 Test-Set 0.004 0.0176 0.042716 Figure 21: Baseline to actual comparison table Figure 22: Grid search results on test data
25 suggests that this method of running machine learning algorithms for specific event types rather than all emergency events can lead to better predictions. Since the model has shown that it is considered better than the baseline, the variable importance tool can give some further insights into the features that are considered to have the most information gained towards predicting the target variable. After a model is selected based on its F0.5-score and the PR-AUC against the test dataset, the feature importance ranking of the model is plotted to understand which features have the most predictive power. This allows for some explanation of the sporadic nature of urban fires in Lisbon. 4.1. VARIABLE IMPORTANCE Considering the variable importance, we can see that all subsections of data appear as important variables. If only the census data (population & buildings) appeared within the top variables then we could conclude that the model is only predicting hotspots. Since the model also includes climate data such as temperature and humidity this means that there is some sort of correlation between these indicators and the fires. Another key variable is the time variable ‘period_early_morning’ because this also puts the model working in terms of time frame. Since the variable importance only shows how important features are, it does not show the relationship between the feature and the target variable (i.e if it contributes positively or negatively.) Another key takeaway from the variable importance plot is the building characteristics. The highest-ranked feature Figure 23: Top 10 variables ranked by variable importance
26 is the number of buildings between 1970 and 1980 and the 10th ranked feature is Nº of buildings of masonry walls without steel structure. This information alone can be used in decision-making for building inspections. Prioritizing building inspections to structures that contain characteristics represented in the variable importance graph could lead to more preventive actions to reduce the risk of future emergency events. Understanding which areas or demographics are most likely to be involved in fires can also help firefighters educate people on how to prevent emergency events from happening. Analysing the Variable importance of some key takeaways can help not only predict future fires but also raises awareness on which factors might make a location more prone to fires than others. Once relevant factors have been identified then, the model can be used as a proposal for an IoT device that allows getting more frequent updates on these figures. 4.2. OUTPUT The final stage of the model is predicting future events for RSB to use in their resource planning. The model is created such that a user can upload a weather forecast for any future period (day, week, month), provided the file is in the same format as the IPMA weather log, and the model will predict probabilities of a positive event per location per 4-hour block. The users can then depending on available resources select the top n locations per 4-hour block, and assign first-response vehicles to the area, so that in the case that an emergency event takes place, they can respond within a 5-minute window.
27 5. CONCLUSIONS To summarize the project, many studies and articles were reviewed to determine the best approach to tackle the issue of predicting emergency events. The overall goal of this project was use skills learnt during the masters to build on top of a similar project that was undertaken as part of a masters project and to try and use the same data sources and data treatments along with state of the art algorithms and functions to develop a machine learning model which can predict individual emergency events within a specific time frame for each of the defined subsections of the city of Lisbon. Whilst being able to be re-trained and scalable with more data sources and different areas. Despite most of the approaches taken is based on the literature review, some changes arose from discussions with the Urban analytics lab at NOVA IMS, which is in close contact with the council of Lisbon, to give both theoretical and practical methods to solving the problem at hand. In terms of the modelling section, various data treatments and algorithms were tested and selected based on appropriate evaluation measures. The model itself is not yet sufficient to be used as the only decision-making tool, however, the groundwork has been developed for the model to constantly improve as more data is fed to it, both event data, but also new predictive variables can be added to the model, as these are available. Overall, the lessons learnt during the masters were applied successfully and the project improved from the previous study conducted using skills learned throughout the Information Management masters and applications of state of the art technologies and methodologies and has set up for future works in the emergency prediction industry.
28 6. LIMITATIONS AND RECOMMENDATIONS FOR FUTURE WORKS 6.1. LIMITATIONS 6.1.1. Weather Data Limitations A potential limitation for this project is the reliability of the unseen data is useful to make predictions. The data used to train the model was actual weather data collected from 3 separate weather stations around Lisbon however, the weather data that will be used to make predictions will be forecasted weather indicators. These indicators are not 100% accurate and therefore will have some error, this error will then carry on into the model and potentially affect the prediction. In terms of the geospatial interpolation of the weather stations to the geographical locations, there are also some limitations. Using the Euclidean distance between location and weather station means that topography is ignored in general, and taking into consideration that Lisbon is a hilly city, not using topography in spatial interpolation might not give an actual representation of the weather indicators. A better spatial interpolation can be used to get more accurate climate data for each census block. Another way to improve the accuracy of the weather data used for training is to increase the number of stations that collect climate data. Currently in Lisbon, more IoT devices are being set up across the city to collect climate data. The data from these can be used moving forward to get more accurate data sources for training the model. 6.1.2. Census Limitations The main limitation of this model is the census data. Since the data is static and has been collected 2 years before the first event of the historical data, it doesn’t take into account changes over time, and therefore can be outdated. Given that the census survey is only collected once every ten years the next available survey will be conducted in 2021, however, according to the Portuguese national institute for statistics, the census blocks in Lisbon will be altered. Specifically, more parishes have been created and the borders have changed, so some districts will have changed their associated parish. This will require the user to recreate the spatial interpolation for emergency events and weather station allocation to use the historical data combined with the new data available. 6.2. FUTURE WORKS As per most supervised machine learning problems, the larger the observation size, the better the model predicts the target variable. Therefore, the best approach to improving the output of the model is to keep adding event data and train the model regularly. By doing so, the model will have more examples to learn from and will in theory generate better predictions. Since the computation time of
29 the entire model running with a single node is about 2.5 hours, running the model weekly or monthly with a cluster of nodes will not be operationally expensive, even though the dataset is larger. Additionally, other data sources can be added to make the model more robust. As seen in the literature review, using economic data such as building valuation and tax amounts are also seen as useful in predicting emergency events. Another potential data source that could be added to the report, is the population in each area. The department for urban analytics is developing a dataset that compiles cellular network data to count the number of people in each location per time frame. If these data sources are at the same granularity level (both spatial and temporal) as the event data, then this can be added to make the model more robust. Despite this not being captured in the census survey this type of information will potentially add another perspective to the data (financial & population movement) and can lead to better performance or better indication of which drivers contain higher importance in predicting each type of emergency event 6.2.1. Predicting other emergency events. In a previous study, using the same data sources, a model was created to predict all emergency events that RSB responded to. In comparison, this model only predicts fires, however, it is built so users of this model and easily change the model so it predicts any other emergency type that RSB responds to. For example, as seen from the variable importance the current model places greater importance on the season being summer. It can be that this model predicts better fires that take place in the summer than in the winter (where there are fewer fires), however, in the winter there are more floods and therefore one can easily switch the target variable to floods. This also allows to take better actionable insights into what are contributing factors for each positive emergency event and has the potential to lead RSB in taking a more preventive approach in tackling emergency events and improving operational efficiency.
30 7. BIBLIOGRAPHY Akandea, A., Cabral, P., Gome, P., & Casteleyn, S. (2019). The Lisbon Ranking for Smart Sustainable Cities in Europe. Sustainable Cities and Society, vol. 44, 475–487. Albino, V., Berardi, U., & Dangelico, R. M. (2015). Smart Cities: Definitions, Dimensions, Performance, and Initiatives. Journal of Uban Technology, 3-10. Aniruddha Bhandari. (2020). Feature Scaling for Machine Learning: Understanding the Difference Between Normalization vs. Standardization. Analytics Vidhya. Bao, J., Liu, P., & Ukkusuri, S. V. (2019). A spatiotemporal deep learning approach for citywide shortterm crash risk prediction with multi-source data. New York City: Elsevier. Brown, M. S. (2015, July 29). What IT needs to know about the data Mining process. Retrieved from Forbes: https://www.forbes.com/sites/metabrown/2015/07/29/what-it-needs-to-know- about-the-data-mining-process/?sh=788ff743515f Brownlee, J. (2020, August 3). A Gentle Introduction to k-fold Cross-Validation. Retrieved from Machine Learning Mastery: https://machinelearningmastery.com/k-fold-cross- validation/#:~:text=Cross%2Dvalidation%20is%20primarily%20used,the%20training%20of%2 0the%20model. Brownlee, J. (2020, Feb). A Gentle Introduction to the Fbeta-Measure for Machine Learning. Retrieved from Machine Learining Mastery: https://machinelearningmastery.com/fbetameasure-for-machine-learning/ Cai, J., Luo, J., Wang, S., & Yang, S. (2018). Feature selection in machine learning: a new. Neurocomputing. Cargaliu, A., Bo, C. D., & Nijkamp, P. (2011). Smart Cities in Europe. Journal of Urban Technology, 62- 65. Chapman, P., Clinton, J., Kerber, R., Khabaza, T., & Reinartz, T. (2000). CRISP-DM 1.0. SPSS Inc. Cipriano, S. (2012, 09 19). Historia dos Bombeiros. Retrieved from Bombeiro.pt Combining Over-Sampling and Under-Sampling Techniques for Imbalance Dataset. (n.d.). Publication:ICMLC 2017: Proceedings of the 9th International Conference on Machine Learning and Computing. Cortez, P., & Morais, A. (2007). A Data Mining Approach to Predict Forest Fires. Minho, Portugal: Associação Portuguesa para a Inteligência Artificial (APPIA). Devisschere, P. K. (2021, 09). H2O in practice: a Data Scientist feedback. Retrieved from Adatlas: https://www.adaltas.com/en/2021/09/29/h2o-automl-data-scientist-feedback/ Driving-radius map application. (2021, January 2). Retrieved from Oalley: https://www.oalley.net/
31 Eidam, E. (2016). Cincinnati Predictive Analytics Project Takes Aim at Emergency Medical Services. Cincinnati: Government Technology. Ekelund, S. (2017, March). Precision-recall curves – what are they and how are they used? Retrieved from acutecaretesting: https://acutecaretesting.org/en/articles/precision-recall-curves- what-are-they-and-how-are-they-used European Commission. (2018). Smart Cities Initiatives. Retrieved from European Commission: https://ec.europa.eu/info/eu-regional-and-urban-development/topics/cities-and-urban- development/city-initiatives/smart-cities_en H2o AI Platform. (2021, 03 1). Retrieved from H20 AI: https://www.h2o.ai/hybrid-cloud/ Haixiang, G., Yijing, L., Shang, J., Mingyun, G., Yuanyue, H., & G., B. (2017). Learning from class imbalanced data: Review of methods and applications. Expert Systems with Applications 73, 220-239. Hand, D., Mannila, H., & Smyth, P. (2001). Principles of Data Mining. MIT Press. Heaton, B. (2015). New York City Fights Fire with Data. Justice and Public Safety. History of Firefighting. (2016, 01). Retrieved from Firefighter Foundation: https://www.firefighterfoundation.org.uk/history/#:~:text=The%20history%20of%20the%20f irefighter,in%20the%203rd%20Century.&text=In%20AD%2060%20Emperor%20Nero,also%2 0as%20a%20police%20force Kapkar, B. (2020, May). Which Machine Learning requires Feature Scaling(Standardization and Normalization)? Retrieved from Kaggle: https://www.kaggle.com/getting-started/159643 LeDell, E., & Poirier, S. (2020, July). H2O AutoML: Scalable Automatic Machine Learning. Retrieved from 7th ICML Workshop on Automated Machine Learning (AutoML): https://www.automl.org/wp-content/uploads/2020/07/AutoML_2020_paper_61.pdf. Ma, W., Feng, Z., Cheng, h., Chen, S., & Wang, F. (2020). Identifying Forest Fire Driving Factors and Related. Forests. Madaio, M., Chen, S.-T., Haimson, O. L., Zhang, W., Cheng, X., Hinds-Aldrich, M., . . . Dilkina, B. (2016). Firebird: Predicting Fire Risk and. San Francisco: KDD. Marsal-Llacuna, M. C.-L.-F. (2015). Lessons in urban Monitoring taken from sustainable and livable cities to better address the Smart Cities Initiative. Technological Forecasting and Social Change, 611-622. Mukhopadhyay, A., Pettet, G., Vazirizade, S., Lu, D., Jaimes, H., Alex, B., . . . Dubey, A. (2020). A Review of Emergency Incident Prediction,. arXivLabs, 2-10. Mukhopadhyay, A., Pettety, G., Vazirizadey, S., & Lu, D. (2020). A Review of Emergency Incident Prediction,. arXiv:.
32 Mukhopadhyay, A., Wang, K., Perrault, A., Kochenderfer, M., & Tambe, M. (2020). Robust Spatial- Temporal Incident Prediction. Centre for Research on Computation and Society. Narkhede, S. (2018, June 26). Understanding AUC - ROC Curve. Retrieved from Towards Data Science: https://towardsdatascience.com/understanding-auc-roc-curve-68b2303cc9c5 NECPortugal. (2020, 05). NEC cooperates with the Lisbon City Council in the development of the Lisboa.24 App. Retrieved from NEC Portugal: https://uk.nec.com/en_GB/press/202005/20200514_01.html Nutthaporn Junsomboon, T. P. (2017). Combining Over-Sampling and Under-Sampling Techniques for Imbalance Dataset. ICMLC 2017: Proceedings of the 9th International Conference on Machine Learning and Computing, 243–247. Pedregosa, F., Varoquaux, G., Gramfort, A., & Michel, V. (2011). Scikit-learn: Machine Learning in {P}ython. Journal of Machine Learning Research, 2825-2830. Retrieved from Scikit-Learn: https://scikitlearn.org/stable/auto_examples/model_selection/plot_precision_recall.html#:~:text=The%2 0precision%2Drecall%20curve%20shows,a%20low%20false%20negative%20rate. Priano, F. H., & Guerra, C. F. (2014). A framework for measuring smart cities. International Conference on Digital Government, 44-45. Roberts, D., & Boyce, M. S. (2017). Cross-validation strategies for data with temporal, spatial, hierarchical, or phylogentic structure. Ecography, 913-929. Roman, J. (2014). Data Driven Information and the brave new world of smart firefighting. National Fire Protection Association, 1-12. Romero, T., Barnes, Z., & Cipollone, F. (2016). Predicting Emergency Incidents in San Diego. Stanford. Roy, B. (2020, April 6). All about Feature Scaling. Retrieved from Towards Data Science: https://towardsdatascience.com/all-about-feature-scaling-bcc0ad75cb35 Saurav, K. (2016). Introduction to Feature Selection methods. Analytics Vidhya. SharingCities.eu. (2020). Lisbon's Profile. Retrieved from SharingCities.eu: http://www.sharingcities.eu/sharingcities/city-profiles/lisbon Srikanth, C. S., Rayudu, T. B., Radhika, J., & Anitha, R. (2019). Smart Waste Management using Internet of Things (IOT). Journal of Innovative Technology and Exploring Engineering, 2518- 2522. Teixeira, L. B. (2018). Optimization of firefighter response with. Lisbon: NOVA IMS. Walia, B. S., Hu, Q., Chen, J., Lee, J., Kuo, N., & Narang, P. (2018). A Dynamic Pipeline for Spatio- Temporal Fire Risk Prediction. Association for Computing Machinery. William, D. E., & John, S. (2018). Forces of change: Smart cities. Deloitte Insights, 4.