scieee AI-readable full text Open interactive document viewer

Architectural Aspects of Sensing Applications for Vehicular Networks: from Data Collection to Data Model Management

Mohammad Nozari Zarmehri

Full text

Architectural Aspects of Sensing Applications for Vehicular Networks: from Data Collection to Data Model Management Mohammad Nozari Zarmehri Supervisor: Prof. Carlos Manuel Milheiro de Oliveira Pinto Soares Doctoral Program in Telecommunications May, 2016 c Mohammad Nozari Zarmehri: May, 2016 Faculdade de Engenharia da Universidade do Porto Architectural Aspects of Sensing Applications for Vehicular Networks: from Data Collection to Data Model Management Mohammad Nozari Zarmehri Dissertation submitted to Faculdade de Engenharia da Universidade do Porto to obtain the degree of Doctor of Philosophy in Electrical and Computer Engineering President: Prof. Eugénio da Costa Oliveira Referee: Prof. José Hernandez Orallo Referee: Prof. Alberto Jorge Lebre Cardoso Referee: Prof. Alexandre Júlio Teixeira dos Santos Referee: Prof. Pavel Bernard Brazdil Referee: Prof. Carlos Manuel Milheiro de Oliveira Pinto Soares May, 2016 It is my deepest gratitude and warmest affection that I dedicate this thesis to my family especially Zhaleh and Amirreza for their constant support. Abstract Vehicular Ad-hoc Networks (VANETs) are part of the communications infrastructure for Intelligent Transportation Systems (ITS), which are becoming an important type of information systems. Additionally, vehicular networks offer various opportunities for gathering data about a city. Vehicles continually sense events from streets and process sensed data. Therefore, utilizing vehicular networks as an infrastructure for urban sensing is a cost-efficient way of deploying an urban monitoring system without actually deploying connected sensors. ITS services based on VANETs require that massive amounts of data are gathered and transferred to a location for storing and making it available for applications that will analyze it. To collect this data using VANETs, an efficient protocol is needed that uses minimum communication time and network resources while providing low delay and high delivery rates. Two important components of the infrastructure of VANET-based ITS applications are the data communication and management to provide the collected data to entities inside or outside the VANET in almost real-time. In this thesis, to cover all aspects required for data communications and data management, the following tasks are done: 1. Design and implement a new protocol for urban sensing and data collection, 2. Performance evaluation of the proposed protocol and evaluate different broadcast suppression techniques, 3. Calculate the sensing capacity and validate it with simulation, 4. Investigate the use of existing hierarchies in the data to improve the performance of the learning process, 5. Propose a metalearning framework for data hierarchy level and algorithm selection, 6. Evaluate the framework by applying it to different datasets. The results of the investigation show that the designed protocol is able to collect the VANETs data efficiently (with high packet delivery and low delay). In addition, the results of the experiment on collected data show that the designed framework is able to suggest the best part of data that should be used for training a model for each entity to obtain the best performance without applying each algorithm on each part of the data separately. Keywords: Data Collection. Machine learning. Data mining. Metalearning. Data Hierarchy. Vehicular Networks. iii Resumo VANETs fazem parte da infra-estrutura de comunicações para Sistemas Inteligentes de Transportes (ITS), que estão a tornar-se um importante tipo de sistemas de informação. Além disso, as redes veiculares oferecem várias oportunidades para a recolha de dados sobre uma cidade. Os veículos estão constantemente a detectar eventos da ruas e a processar os dados adquiridos. Assim, a utilização de redes veiculares como uma infra-estrutura para detecção urbana é uma forma eficiente em termos de custo de implantação de um sistema de monitorização urbano sem realmente implementar sensores conectados. Os serviços ITS baseados em VANETs exigem que grandes quantidades de dados sejam recolhidos e transferidos para um local de armazenamento e tornando-os disponíveis para aplicações que os irão analisar. Para recolher esses dados usando VANETs, é necessário um protocolo eficiente que use tempo mínimo de comunicação e recursos de rede, proporcionando low delay e high packet delivery. Dois componentes importantes da infra-estrutura de aplicações ITS baseadas em VANET são a comunicação e gestão de dados. Para fornecer os dados recolhidos para entidades dentro ou fora da VANET aproximadamente em tempo real. Nesta tese, de forma a cobrir todos os aspectos necessários para a comunicação e gestão de dados, foram realizadar as seguintes tarefas: 1. conceptualizar e implementar um novo protocolo para sensorização urbana e recolha de dados, 2. Avaliação do desempenho do protocolo proposto e avaliação de diferentes técnicas de broadcast suppression, 3. Calcular a capacidade de detecção e validá-la com a simulação, 4. investigar o uso de hierarquias existentes nos dados para melhorar o desempenho do processo de aprendizagem, 5. Propor uma framework metalearning para o nível de hierarquia de dados e seleção de algoritmos, 6. Avaliar a framework, aplicando-o em diferentes conjuntos de dados. Os resultados da investigação mostram que o protocolo projetado é capaz de recolher os dados VANETs de forma eficiente (com high packet delivery e low delay). Além disso, os resultados de ensaios em dados recolhidos mostram que a estrutura concebida é capaz de sugerir a melhor parte de dados que devem ser usados para o formo de um modelo para cada entidade para obter v Contents List of Figures xix List of Tables xxi List of Abbreviations xxvi 1 Introduction 1 1.1 Motivation...................................... 3 1.2 Challenges...................................... 5 1.3 Research Objectives and Contributions . . . . . . . . . . . . . . . . . . . . . . . 6 2 State of the Art 9 2.1 Technologies and Standards . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 2.2 VANETStandards.................................. 10 2.3 Datagathering.................................... 12 2.4 RoutingProtocols.................................. 12 2.4.1 Ad hoc Routing Protocols . . . . . . . . . . . . . . . . . . . . . . . . . 12 2.4.2 Cluster-Based Routing Protocols . . . . . . . . . . . . . . . . . . . . . . 13 2.4.3 Per-hopForwarding ............................ 13 2.4.4 DataDissemination............................. 14 2.4.5 Unicast/Multicast/Geocast . . . . . . . . . . . . . . . . . . . . . . . . . 15 2.5 AlgorithmSelection................................. 19 2.5.1 Meta-Learning ............................... 19 2.5.2 TripDuration................................ 20 I Data Collection 21 3 Data Gathering for Sensing Applications in Vehicular Networks 23 3.1 Introduction..................................... 23 3.2 Broadcast-based Data Gathering Protocol . . . . . . . . . . . . . . . . . . . . . 24 3.2.1 BPFProtocolDesign............................ 25 3.2.2 How to map the back-off value to time? . . . . . . . . . . . . . . . . . . 28 3.2.3 Back off-based forwarding algorithm . . . . . . . . . . . . . . . . . . . 28 3.3 Simulation...................................... 29 3.4 PerformanceEvaluation............................... 30 3.4.1 PacketDeliveryRatio ........................... 30 3.4.2 End-to-EndDelay ............................. 31 3.4.3 Number of Hops and Amount of Replicas . . . . . . . . . . . . . . . . . 32 xiii xiv CONTENTS 3.4.4 Scaling Source Nodes . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 3.5 Summary ...................................... 35 4 Supporting Sensing Application in Vehicular Networks 37 4.1 Introduction..................................... 37 4.2 Data Collection Challenges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 4.3 ProtocolDesign................................... 39 4.3.1 Directional Forwarding . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 4.3.2 Suppression Techniques . . . . . . . . . . . . . . . . . . . . . . . . . . 42 4.3.3 ChannelAccessTime............................ 44 4.4 Simulation...................................... 45 4.5 PerformanceEvaluation............................... 46 4.5.1 Sensingaccuracy.............................. 46 4.5.2 NetworkEfficiency............................. 47 4.5.3 PacketDropAnalysis............................ 48 4.6 Summary ...................................... 49 5 Numerical Limits for Data Gathering in Wireless Networks 51 5.1 Introduction..................................... 51 5.2 NetworkModel................................... 52 5.3 Maximum Service Rate without Collisions . . . . . . . . . . . . . . . . . . . . . 52 5.4 InterferenceModel ................................. 55 5.5 Results........................................ 59 5.5.1 End-2-EndPDR% ............................. 59 5.5.2 ServiceRate ................................ 60 5.6 Discussion...................................... 61 5.7 Verification of the results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62 5.8 Conclusion and Future Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64 II Data Management for Modeling 67 6 Improving Model Performance by Using Existing Hierarchies in the Data 69 6.1 Background..................................... 71 6.1.1 Foreign Trade Dataset . . . . . . . . . . . . . . . . . . . . . . . . . . . 71 6.1.2 Goals and Previous results . . . . . . . . . . . . . . . . . . . . . . . . . 72 6.2 Error Detection Methodology . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72 6.2.1 Data Preparation and Exploration . . . . . . . . . . . . . . . . . . . . . 72 6.2.2 Error detection method . . . . . . . . . . . . . . . . . . . . . . . . . . . 74 6.2.3 Evaluation ................................. 77 6.3 Results........................................ 79 6.3.1 SelectedExamples ............................. 80 6.3.2 Comparing Results Obtained with Data From Different Levels of the ProductHierarchy................................ 81 6.3.3 Personalized Data Selection is Required for Optimal Results . . . . . . . 82 6.4 Summary ...................................... 86 CONTENTS xv 7 A Metalearning Framework for Model and Data Granularity Selection 87 7.1 Methodology .................................... 88 7.1.1 Traditionalmethod............................. 88 7.1.2 Proposed Metalearning Framework . . . . . . . . . . . . . . . . . . . . 91 7.2 Summary ...................................... 97 8 Validation of the Metalearning framework: A Case Study on Error Detection in Foreign Trade Statistics 99 8.1 Case study: error detection in foreign trade statistics . . . . . . . . . . . . . . . . 99 8.2 Methodology .................................... 101 8.2.1 Metafeatures ................................ 102 8.3 ExperimentsSetup ................................. 105 8.4 Base-level...................................... 105 8.5 Meta-level...................................... 105 8.6 Results........................................ 106 8.6.1 Base-levelResults ............................. 107 8.6.2 Base-level vs. Meta-level . . . . . . . . . . . . . . . . . . . . . . . . . . 108 8.7 Summary ...................................... 112 9 Using Metalearning for Prediction of Taxi Trip Duration Using Different Granularity Levels 115 9.1 Motivation...................................... 116 9.2 Methodology .................................... 116 9.2.1 Dataset ................................... 116 9.2.2 Base-levelApproach............................ 117 9.2.3 Meta-levelApproach............................ 118 9.2.4 Metafeatures ................................ 120 9.2.5 Metadata .................................. 122 9.3 Evaluation...................................... 122 9.3.1 Base-levelevaluation............................ 122 9.3.2 Meta-levelevaluation............................ 123 9.4 Results........................................ 123 9.4.1 Base-levelresults.............................. 124 9.4.2 Meta-levelresults.............................. 126 9.4.3 Base-level vs. meta-level results . . . . . . . . . . . . . . . . . . . . . . 130 9.5 Summary ...................................... 131 10 Conclusions and Future Work 133 10.1Conclusion ..................................... 133 10.2FutureWork..................................... 135 Bibliography 137 Index 159 A Description of the Metafeatures 159 List of Figures 1.1 VANETsvs.MANETs ............................... 1 1.2 Snapshot showing a part of transmit-receive pairs in the city of Porto Boban et al. (2014)........................................ 3 1.3 Intelligent Transportation Systems use cases and potential communication technologies, defined by ETSI ITS ........................... 4 1.4 Data gathering hierarchy in vehicular networks . . . . . . . . . . . . . . . . . . 5 2.1 DSRC Channel allocation in north America Qian and Moayeri (2008) ...... 10 2.2 Frequency allocation in Europe Consortium (2008) ................ 11 3.1 Node configuration used for calculations . . . . . . . . . . . . . . . . . . . . . . 25 3.2 Back off time in microseconds for different positions around a node located at (0,0)according to C1and C2. Location of the final destination (2000,0)(horizontally to the right of the plot) and communication range is 500 m. . . . . . . . . . 27 3.3 Flowchart of data gathering Protocol . . . . . . . . . . . . . . . . . . . . . . . . 29 3.4 PDR% for 4 different protocols with 8 sources (20kbps) ............. 31 3.5 Delay for 4 different protocols with 8 sources (20kbps).............. 32 3.6 Number of hops for 4 different protocols with 8 sources (20kbps)......... 33 3.7 Average Number of replicas per uniquely received packets for 4 different protocols with 8 sources (20kbps)............................... 34 3.8 PDR% for different number of source with 9.6 nodes/km . . . . . . . . . . . . . 35 4.1 UDC help packets to get to the gateway when a path in the direction of gateway is blockedbyabuilding................................. 39 4.2 UDC avoid packet die out when an accident happens on the direction of the gateway. 40 4.3 One-hop forwarding entities . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 4.4 Forwarding Probability calculated for different suppression techniques . . . . . . 43 4.5 Protocolalgorithm ................................. 44 4.6 Average channel access time for 4 suppression techniques.The slotted 1-persistence protocol used for comparison is introduced in Chapter 2. ............. 45 4.7 Sensing accuracy for different data collection mechanism in urban area . . . . . . 47 4.8 Efficiency for using different suppression techniques . . . . . . . . . . . . . . . 48 4.9 Different reasons for drop packets depend on different communication layers . . 48 5.1 Networkmodel ................................... 52 5.2 Performance of a simple Chain . . . . . . . . . . . . . . . . . . . . . . . . . . . 54 5.3 ChainPerformance ................................. 57 5.4 PDR% for different chain length . . . . . . . . . . . . . . . . . . . . . . . . . . 60 5.5 Service Rate for different chain length . . . . . . . . . . . . . . . . . . . . . . . 61 xvii xviii LIST OF FIGURES 5.6 Trade-off between Service rate and PDR% . . . . . . . . . . . . . . . . . . . . . 62 5.7 Verification of probability of at least one collision . . . . . . . . . . . . . . . . . 63 5.8 Comparison of Simulation (S) and analytical (A) results for the end-to-end PDR% 64 6.1 An example of existing hierarchical structure within the data set: Product codes starting with 11 and for simplicity only show the product codes starting with 1129. 74 6.2 Number of catogories for each level in each month . . . . . . . . . . . . . . . . 76 6.3 The definition of quartiles and IQR . . . . . . . . . . . . . . . . . . . . . . . . . 76 6.4 The distribution of scores obtained by the outlier detection method at the 4 levels for Product code starting with 11 in February . . . . . . . . . . . . . . . . . . . 79 6.5 Import transactions (February) . . . . . . . . . . . . . . . . . . . . . . . . . . . 80 6.6 Export transactions (February) . . . . . . . . . . . . . . . . . . . . . . . . . . . 80 6.7 Import transactions (June) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80 6.8 Export transactions (June) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80 6.9 Thebesteffort.................................... 81 6.10Thebestrecall.................................... 81 6.11 The average best effort with respective recall for each month . . . . . . . . . . . 83 6.12 The average best recall with respective effort for each month . . . . . . . . . . . 83 6.13 The average effort in each month when the training data is always selected from: The best level (Dark Green), Level 4 (Light Green), Level 3 (Gray), Level 2 (Yellow),orLevel1(Red)................................ 84 6.14 The average recall in each month when the training data is always selected from: The best level (Dark blue), Level 4 (Red), Level 3 (Yellow), Level 2 (Gray), or Level1(Lightblue)................................. 84 6.15Theoptimumeffort................................. 86 6.16Theoptimumrecall................................. 86 7.1 Illustration of a hierarchy in datasets: for each category the best performance (black model) is obtained at different levels . . . . . . . . . . . . . . . . . . . . 88 7.2 Traditional Data Mining approach . . . . . . . . . . . . . . . . . . . . . . . . . 89 7.3 The proposed hierarchy structure . . . . . . . . . . . . . . . . . . . . . . . . . . 92 7.4 The data structure used in the proposed model . . . . . . . . . . . . . . . . . . . 93 7.5 Proposed methodology used for metalearning . . . . . . . . . . . . . . . . . . . 96 8.1 An example of existing taxonomy in foods . . . . . . . . . . . . . . . . . . . . . 100 8.2 Methodology used for metalearning . . . . . . . . . . . . . . . . . . . . . . . . 104 8.3 Decision Tree structure: at each split one feature (F1 to F4) is evaluated . . . . . 106 8.4 The effort obtained from base-level vs. meta-level . . . . . . . . . . . . . . . . . 109 8.5 Comparing the accuracy of metalearning approaches with the baseline . . . . . . 110 8.6 Comparing metalearning with different algorithms with baseline: Recall . . . . . 111 8.7 Comparing metalearning with different algorithms with the baseline: Effort . . . 112 9.1 Illustrative map of Porto, Portugal. The green dots are the taxi placement. The neighboring area for red and black taxi is shown by purple circle around them. . . 117 9.2 Proposed methodology used for metalearning . . . . . . . . . . . . . . . . . . . 119 9.3 NRMSE[%] for different months . . . . . . . . . . . . . . . . . . . . . . . . . . 124 9.4 NRMSE for all algorithms at each level in different months . . . . . . . . . . . . 125 9.5 The percentage of the best algorithm in all months: base-level . . . . . . . . . . 126 9.6 The average Scalederror[%] over all taxis for each month . . . . . . . . . . . . . 128 LIST OF FIGURES xix 9.7 The NRMSE for the worst, the best and the meta-level results: ML-RF and ML-DT 129 9.8 Distribution of Scalederror overeachtaxi...................... 130 9.9 Accuracy: base-level vs. meta-level . . . . . . . . . . . . . . . . . . . . . . . . 131 List of Tables 2.1 Differences between 802.11p and 802.11a . . . . . . . . . . . . . . . . . . . . . 11 4.1 SimulationSetup.................................. 45 4.2 Percentage of each reasons in the protocol performance for different node densities 49 5.1 Number of time slots for each iteration . . . . . . . . . . . . . . . . . . . . . . . 60 6.1 Datasetfeatures................................... 71 6.2 Illustrative sample of the dataset . . . . . . . . . . . . . . . . . . . . . . . . . . 73 6.3 An exploratory data analysis for datasets . . . . . . . . . . . . . . . . . . . . . . 75 6.4 Concepts used in evaluation metrics . . . . . . . . . . . . . . . . . . . . . . . . 77 6.5 Illustrative results for effort obtained by applying the method at different levels of the product hierarchy. The optimal selection is the lowest effort amongst 4 levels. 82 6.6 The average result for the best effort and its related recall and the best recall and itsrelatedeffort.................................... 83 6.7 The average result for the best effort for acceptable recall and the best recall for acceptableeffortbyexpert.............................. 85 7.1 A simple statistics about Taxi dataset . . . . . . . . . . . . . . . . . . . . . . . . 90 7.2 The description of Taxi dataset’s features . . . . . . . . . . . . . . . . . . . . . . 91 8.1 Extracted features used in metalearning - INTRASTAT dataset . . . . . . . . . . 103 9.1 The description of metafeatures used for metalearning . . . . . . . . . . . . . . . 121 9.2 The meta-level results (the percentage of occurrence) for the best algorithm and the best level of granularity on different months. Columns: meta-levels algorithms. Rows:base-levelalgorithms ............................ 127 A.1 Extracted features used in metalearning - INTRASTAT dataset . . . . . . . . . . 161 A.2 The description of metafeatures used for metalearning - Taxi dataset . . . . . . . 162 xxi 2Introduction higher and the node density lower than in an urban environment. However, in the former scenario, there are fewer obstacles and nodes do not change direction abruptly behind a building, as it can happen at a crossroad in a dense urban area. VANETs are part of the communications infrastructure for Intelligent Transportation Systems (ITS), which are becoming an important type of information systems Chadwick et al. (1993). There are mainly three categories of ITS applications: public safety, traffic management, and infotainment. The overall goal of a public safety application is to reduce accidents, with many benefits beyond the obvious saving of lives. Examples of safety applications of ITS are: forward obstacle detection and avoidance Badal et al. (1994); turn accident warning and intersection collision warning Lee et al. (2009a). Using technology to improve the flow of traffic and reduction of congestion is the goal of traffic management. Smart traffic signs, rapid response to incidents, central traffic management, enhanced public transit systems and electronic toll collection are a few examples of traffic management applications Lee et al. (2006). Another category of applications that could be provided in vehicles is infotainment. This kind of application provides additional information for drivers and entertainment to passengers like multimedia services, Internet connectivity and instant messaging. Also some other information provision services, like weather and parking services Lochert et al. (2008) belong in this category of VANET applications. Additionally, vehicular networks offer various opportunities for gathering data about a city. Vehicles continually sense events from streets and process sensed data. Some examples using data gathered in real-time from the in-car sensors can be: Monitoring the fuel consumption from the in-car sensors in real-time can be used to identify areas of the city with high levels of pollution Liimatainen (2011); Zhou et al. (2013); Monitoring the brakes of cars to detect areas where drivers brake often without any apparent reason may be helpful in detecting dangerous conditions, like bad roads Murphy et al. (2006); Cheifetz et al. (2011); Detecting traffic jams and managing the traffic load in a different way Myr (2002); Improving traffic conditions Rudolf et al. (1997); Rescheduling traffic lights Zhou et al. (2010); Planing trip routes Yamamoto et al. (2002); Predicting trip duration of cars and public transports Balan et al. (2011); Mendes-Moreira et al. (2015); Eliminating traffic blind spots Keirstead (2004); Evaluating drivers behavior Noshadi et al. (2008a); Hasan et al. (1997); Measuring air quality and noise Lin and Yu (2008); Monitoring city environment Kamijo et al. (2000); Zhou et al. (2007). These examples show that using the in-car sensors as data sources and cars as data carriers, a macro vision of the city can be obtained. Therefore, utilizing vehicular networks as an infrastructure for urban sensing is a cost-efficient way of deploying an urban monitoring system without actually deploying connected sensors Englund et al. (2015). Vehicles typically do not have energy constraints and can be equipped with powerful processing units, wireless transmitters, and sensing devices (GPS, detectors, video cameras, vibration sensors, acoustic detectors, car sensors, etc). The gathered data can be processed and visualized live, enabling monitoring activities (Figure 1.2) and better decision making. However, this data can also be serve as the basis for predictive models that move the decision processes one step further. Given the availability of an increasing 1.1 Motivation 3 amount of data, data mining approaches are being used to obtain models that are integrated into ITS applications (Figure 1.4)Thill (2000); Hauser and Scherer (2001); Chan and Marco (2004); Salim et al. (2007); Wang (2010); Qureshi and Abdullah (2013); He et al. (2014a,b). Figure 1.2: Snapshot showing a part of transmit-receive pairs in the city of Porto Boban et al. (2014) 1.1 Motivation ITS services based on VANETs (Figure 1.3) require that massive amounts of data are gathered and transferred to a location for storing and making it available for applications that will analyze it (Figure 1.4). The existence of cars moving in the city can help collect this massive amount of data from the already implemented infrastructure without extra cost. To collect this data using VANETs, an efficient protocol is needed. An adequate data gathering protocol needs to use minimum communication time and network resources while providing low delay and high delivery rates. Two important components of the infrastructure of VANET-based ITS applications are the data communication and management. Concerning data communication, the purpose is to provide the collected data to entities inside or outside the VANET in almost real-time. This corresponds to a system architecture where several or all nodes in the VANETs are data sources and the ultimate destination of the data lies outside the VANET in which it originated, whereby data can get there through one or more gateways. On one hand, in a highly variable network (cars move in VANETs), unicast/multicast communication, in which a predefined route is selected for communication using continuously exchange neighbor information, is not feasible. On the other hand, in scenarios of high node density a 4Introduction Figure 1.3: Intelligent Transportation Systems use cases and potential communication technologies, defined by ETSI ITS broadcast communication impairs communication in VANETs. Therefore, a new solution for data gathering in VANETs is required. Concerning data management for decision making, traditionally, data mining (DM) applications use a single model, created by applying algorithms on all data (or a carefully selected part of it). For example, a single model has been used to predict the trip duration in public transportations Mendes-Moreira et al. (2012). However, in a VANET, data is collected in different settings and the phenomena that is under analysis may also vary dramatically. Therefore, the best model may vary, which means that a different learning process must be used (i.e. different datasets, different parameter settings and/or different algorithms). This is consistent with what has already been shown in general for machine learning applications, namely that there is no commonly best algorithm for a broad domain of problems Wolpert and Macready (1997). To have the best performance for each entity, different approaches can be used. To obtained the best performance, each entity can use its data or the data from its neighbors or even the data from whole network’s entities for modeling. This decision can be made using different approaches. One of the traditional approaches is expert advice. They can suggest a specific setting for modeling including an algorithm and the part of data that should be used to have the best performance according to their experience. However, due to the variety of entities involved (i.e., different vehicles) and the variable nature of datasets, experts are unable to capture all the different possibilities 1.2 Challenges 5 Figure 1.4: Data gathering hierarchy in vehicular networks and the advice may end up being an inaccurate model. Another way of algorithm selection can be obtained by a trial-and-error approach. A set of algorithms is selected and applied to the datasets to obtain the best performance which needs a high computational cost. This approach may be helpful for small size datasets, but it is computationally costly for medium and large datasets. An approach that has been used in several algorithm selection problems is metalearning Brazdil et al. (2003a); Soares et al. (2004,1999); Torgo and Soares (2010). Metalearning models the relationship between the characteristics of the data with the performance of the algorithms. Given a new dataset, the (meta-)model is used to predict the algorithm that is expected to obtain the best performance. 1.2 Challenges Data gathered from vehicles can be disseminated through the network in different ways depending on the application. For example, for a safety application, vehicle nodes broadcast a warning message and nodes that receive the message can use it and forward it by rebroadcasting. But for an infotainment application like games, the Internet and electronic toll collection, data needs to be sent unicast to a specific node or infrastructure. 6Introduction For gathering data sensed by vehicles over VANETs in urban environment, the data from every node must be sent to one or more gateways (RSU or On-Board Units (OBU)) which are connected to a storage location to make the data available to applications outside the network. Due to high mobility of vehicles, being bounded by roads and dependent on density, vehicles cannot always communicate directly with each other or with a RSU. For getting a message to its final destination within the vehicle network, it must be forwarded by other nodes through several hops (multi-hops scenario). Since the wireless medium is a shared medium, it is necessary to keep the amount of messages in the network bounded. Therefore, a proper algorithm for data gathering is critical for efficient operation of a VANET-based urban sensor network. All nodes in a VANET-based urban sensor network are simultaneously both data sources and potential relays for the messages from other nodes. It is yet unclear: what is the maximum amount of data that can be gathered from each node per unit time, which is the sensing capacity. Moreover, it depends on the data gathering protocol as well as on any mechanisms used for improving communication efficiency. In this respect, it must also be considered that a sensing application may tolerate a limited amount of losses, which can be traded off for efficiency mechanisms. So a challenge is to provide a network protocol for efficiently (having high packet delivery and low delay) gathering data in an urban environment by vehicular nodes and making it available to outside applications. In a city scenario, even by using an efficient algorithm, the amount of data gathered from different areas depends on the number of cars in that area. So it is probable to have a low amount of data or even no data for a certain area in the city. Therefore, this data may not be enough for decision making or creating a model. Dealing with this challenge, the modeling can be made using the data from neighboring cars, the data in the nearest RSU, or even the data in the central point where the whole data is stored. 1.3 Research Objectives and Contributions The most popular way to gather data from VANETs is broadcasting Li and Wang (2007). But broadcasting data in a dense network causes collisions, a problem also known as a broadcast storm problem, which causes severe impairment in the communications. The objective for data collection is to benchmark the performance of existing protocols in urban scenarios with different traffic densities and to propose a solution for the broadcast storm problem that addresses the requirements of massive urban sensing applications. While all the VANET nodes regularly generate data for multi-hop communication over a shared medium, another objective is to address the problem of estimating the sensing capacity of a VANETs to determine the limits that a node should be considered for generating data. The final goal of the project is to design a general data mining framework for data analysis, in which, by taking advantage of existing structure in the data, improve the performance of simple data mining and machine learning algorithms. Then, by extending the framework to use a met- 1.3 Research Objectives and Contributions 7 alearning, we try to reduce the computational costs and to improve the performance at the same time. Therefore to meet the objectives of the project, the following contributions are done. The work is focused on improving data communications and management in VANET-based ITS applications. To gather the data in servers that lie outside the VANETs in almost real-time, a very specific system – where there is no peer to peer communication, the data sources are distributed in the network (all network nodes are sources themselves), the ultimate destination of the data is a server outside the VANETs, that server is connected to the VANETs over one of several VANETs gateways (RSUs)– is required. In this scenario, there are lots of data packet collisions. Especially, for the area far from the RSUs, the data packets should take a long multi-hop path to RSUs. So the probability of collisions increases. Therefore to design a protocol for this purpose, reducing the number of collisions should be taken into account for increasing the efficiency. In this direction, the following contributions are done: 1. Design and implement a new protocol for urban sensing and data collection (Chapter 3). 2. Performance evaluation of the proposed protocol and evaluate different broadcast suppression techniques (Chapter 4). 3. Calculate the sensing capacity and validate it with simulation (Chapter 5). Consequently, the collected data should be managed by choosing the right piece of data and the right algorithm to build a model for a particular unit in a specific area, taking into account the specificities of the VANET. So an experimental framework was proposed and evaluated on different datasets, including a dataset unrelated to VANETs but with some common properties which made it adequate for this purpose. Finally, the framework is applied to the data from a real world implementation (the DRIVE-IN project Cmuportugal.org (2014)) which was collected in an urban area from 440 taxis in the city of Porto. The main contributions for this phase were: 4. Investigate the use of existing hierarchies in the data to improve the performance of the learning process (Chapter 6). 5. Propose a metalearning framework for data hierarchy level and algorithm selection (Chapter 7). 6. Evaluate the framework by applying it on different datasets (Chapters 8and 9). Chapter 2 State of the Art In this chapter, we will summarize the state of the art related to the vehicular networks and machine learning and data mining. The standard and technologies which are used in VANETs are described in Section 2.1. 2.1 Technologies and Standards The advent of Dedicated Short Range Communications (DSRC) makes the scenarios depicted in the previous chapter realistic in a near future. In October 1999, the United States Federal Communications Commission (FCC) allocated 75 MHz of the spectrum in the 5.9 GHz band to be used by Intelligent Transportation Systems (ITS) in the USA. DSRC supports high vehicle speeds, a transmission range of up to 1000 m, and default data rate of 6 Mbps (up to 27 Mbps) in that frequency band Commission (2015). In Europe, in August 2008 the European Telecommunications Standards Institute (ETSI) allocated 30 MHz of spectrum in the 5.9 GHz band for ITS ETSI Headquarters (2008). In addition, the Car-to-Car Communication Consortium (C2C-CC) was created by car manufacturers with the main objective of increasing road traffic safety and efficiency by means of inter-vehicle communication Consortium (2008). The main goal of C2C-CC is to enable the different brands of cars to communicate with each other and with RSUs. IEEE has recently released the 802.11p standard for adding wireless access in vehicular communications iee (2013). The IEEE 1609 family of standards for wireless access in vehicular environments (WAVE) is a higher layer standard based on IEEE 802.11 iee (2013). WAVE is ensured the secure communication for V2V and V2I by introducing the standards and architectures. The IEEE 1609 family consists of four sub-protocols as follows: 1. IEEE 1609.1: it introduces the data and services within the WAVE architecture and also the format of messages and data storage that are required to communicate between different components of the WAVE architecture. 2. IEEE 1609.2: it defines the security issues to exchange messages. 9 10 State of the Art 3. IEEE 1609.3: it consists of all network and transport protocols required for supporting secure data exchange in WAVE. 4. IEEE 1609.4: it is an improvement of 802.11 Media Access Control (MAC) to support the WAVE functionalities. 2.2 VANET Standards The DSRC spectrum is divided into 8 channels: one 5 MHz channel reserved for future use and 7 channels with 10 MHz bandwidth. Channels 174, 176 and channels 180, 182 can be aggregated to form 20 MHz channels, 175 and 181, respectively. Channel 178 is the control channel. Channels 172 and 184 are reserved for V2V advanced accident avoidance and high power public safety applications, respectively. The rest is available for both safety and non-safety channels. The channel allocation of DSRC in North America and Europe is shown in Figures 2.1 and 2.2, respectively. Figure 2.1: DSRC Channel allocation in north America Qian and Moayeri (2008) 2.2 VANET Standards 11 Figure 2.2: Frequency allocation in Europe Consortium (2008) The 802.11p protocol uses Carrier Sense Multiple Access with Collision Avoidance (CSMA/CA) of 802.11 and the QoS supplement of 802.11e iee (2002). A node wishing to transmit should listen to the channel during the Arbitration Inter Frame Space (AIFS) (in 802.11e)/ Distributed Interframe Space (DIFS) (802.11a) and if the channel is busy during the listening period, then it performs backoff. The backoff procedure has two variables: Contention Window (CW) and Backoff count (BO). If the channel is busy, the node selects a random number between 0 and the CW ([0,CW]) for BO and only if the channel is free, it counts down the BO. If another station starts transmitting, the waiting nodes stop their counting down of BO and will do the same after the channel becomes free. Initially and after each successful transmission, CW is set to CWmin and after each unsuccessful attempt, it is set to min{2×CW +1,CWmin}. At the physical layer, IEEE 802.11p is essentially based on OFDM PHY defined for 802.11a iee (1999). But there are some differences between the two standards at the physical layer, as presented in Table 2.1. Table 2.1: Differences between 802.11p and 802.11a Parameter 802.11p 802.11a Channel Bandwidth (MHz) 10 20 Data Rate (Mbps) 3 to 27 6 to 54 Slot Time (µs) 16 9 Air propagation time (µs) <41 CW (slots) [15,1023] [15,1023] Latency <50ms Seconds Range (m) <1<100 Mobility (mph) < 60 < 5 18 State of the Art area and use one of the three broadcast suppression techniques. On the other hand, it is possible that some nodes have very few neighbors and so they can use the store-carry-forward technique, which is typically used in sparse areas. Furthermore, there are some other approaches that discuss the broadcast issue in VANETs in general. For example, Durrest et al. Durresi et al. (2005a) introduced BROADCOMM for emergency applications which is based on geographical routing and has a virtual structure. A highway is divided into some virtual section that moves with vehicle. They suggest IEEE802.11 for the MAC layer and 350-400 m as the length of each section. The first level of the hierarchy is all the nodes within a section and the second level is represented by nodes which are usually located close to the geographical center of the section, and which are called cell reflectors. The live time of cell reflector is defined for a certain time interval and they will handle the emergency messages coming from members of the same section, or close members from neighbor sections. The source node broadcasts the emergency message within its section. Cell reflectors will multicast the message to other cell reflectors and so on. If a cell reflector becomes a bottleneck, another node will be selected to become the second cell reflector and the traffic will be shared between the two cell reflectors. The Urban Multi-Hop Broadcast protocol (UMB) Korkmaz et al. (2004a) is designed to overcome broadcast storm, packet collisions, and hidden nodes problems in an urban area. In this protocol, the source node tries to select the furthest node in the broadcast direction (directional broadcast) and then will send the messages to that node for forwarding. The nodes do not have any prior information about their neighbors. The authors proposed to install repeaters in all intersections which will forward the packets in all road segments. They used Request to Broadcast (RTB)/Clear to Broadcast (CTB) instead of RTS/CTS. The UMB protocol utilizes the channel very efficiently since the forwarding duty is assigned to only one node in the broadcast direction. Vector-based TRAcking DEtection (V-TRADE) and History-enhanced V-TRADE (HV-TRADE) Yamada et al. (2002) are GPS-based message broadcasting protocols. The goal is to improve bandwidth utilization. The basic idea is similar to the unicast routing protocol Zone Routing Protocol (ZRP) Haas et al. (2002). Each node has a message to rebroadcast, send a position request to other nodes and wait for a certain period of time for a reply from its neighbors. Based on position and movement information received from its neighbors, their methods classify the neighbors into five different forwarding groups: same_road_same_direction_ahead, same_road_same_direction_behind, same_road_opposite_direction_ahead, different_road and same_road_opposite_direction_behind. For each group, only a small subset of vehicles (called border vehicles) is selected to rebroadcast the message. They show significant improvement of bandwidth utilization with slightly loss of reachability, because of fewer vehicles to re-broadcast the messages. The V-TRADE has a little higher bandwidth utilization than HV-TRADE, but HV-TRADE has better reachability than V-TRADE. 2.5 Algorithm Selection 19 2.5 Algorithm Selection 2.5.1 Meta-Learning The algorithm selection problem was formally defined by Rice in 1976 Rice (1976). The main question was that which algorithm has the best performance for a specific problem? The metalearning started to shape in the late eighties Brazdil et al. (2009). Finding the relevant meta-features for predicting the performance of the base-level algorithms is discussed in different research works Aha (1992a); Michie et al. (1994); Gama and Brazdil (1995); Brazdil (1998); Keller et al. (2000); Brazdil et al. (2003b). Meta-features may have information regarding the error-rate of base-level algorithms which is called landmarkers Bensusan and Giraud-Carrier (2000); Pfahringer et al. (2000). Several project with the relevant results to the meta-learning have been launched. The first formal project in this area was MLT project Kodratoff et al. (1992). The MLT project create a special system called Consultant-2 which can help to select the best algorithm for a specific problem. The next two projects in this area were: Statlog Michie et al. (1995) and METAL Brazdil et al. (2003a). In these projects, the level of adaptation was the main difference between meta-learning and the traditional base-learning approaches. It may also be important to select the best base-level algorithm not for the whole data set, but rather for subset of the data set Brodley (1995) of even for the individual example Todorovski and Džeroski (2003). Tuning the parameter of specific base-level algorithm is another task that metalearning can be helpful Soares et al. (2004). They try to tune the width of the Gaussian kernel. Rijn et al. van Rijn, JanN. and Holmes, Geoffrey and Pfahringer, Bernhard and Vanschoren (2014) have investigated the use of meta-learning for algorithm selection on Data Streams. Calculated Meta-features on a small data window at the start of the data stream provide information about the best algorithm. Meta-learning uses this information for the algorithm prediction in the next data windows. And finally, a survey of meta-learning as reported by the machine-learning literature is provided in Vilalta and Drissi (2002). One of the main objective of research in the community is to develop a meta-learning approach which is able to deal with the increasing number of models. It can produce advice dynamically on the algorithm selection problem. Dealing with this problem – the selection of different levels for different products –, metalearning approach is useful. It maps the characteristics of the data with the ideal level of granularity Brazdil et al. (2009). DM models can be learned at different level of granularity. Consequently, the data characteristics can be calculated and used to determine the best level for each product Soares et al. (1999); Torgo and Soares (2010). In 1976, John Rice used the term algorithm selection Rice (1976) which correlates the data characteristics of a specific problem with the performance of the algorithms. Characterization of a classification problem and its effect on algorithm performance is investigated by Rendell and Cho Rendell and Cho (1990). They use the size and concentration of the classes as features. This idea was extended in 1992 by Aha Aha (1992b). Aha creates rules for learning, i.e., 20 State of the Art if a given dataset has specific characteristics (C1, C2, ..., Cn) then algorithm A1should be selected. The number of examples, number of classes, number of prototypes per class, number of relevant and irrelevant attributes, and the distribution range of examples and prototypes were the selected features. On the far side of the task of algorithm selection problem, there are many other problems that the same idea can be derived. For example to select the best parameter settings (Levels in our case), a meta-learning approach can be used. In 2005, Ali and Smith (2005) utilized meta-learning to find the best kernel to use within support vector machines (SVMs). By changing the kernel, the algorithm changes and in results there will be different performance for each setting. Also an interesting framework for optimizing algorithm parameter by using meta-learning is presented in Duch and Grudzinski (2001). In addition, a meta-learning algorithm for supporting the selection of learning algorithms is presented in Brazdil et al. (2003c). It uses k-Nearest Neighbor algorithm to determine the datasets that are most similar to the under evaluation dataset. They use ranking rather than classification as a new contribution. Similar approach to the one presented in this section can be used for selecting the right level of granularity in our problem. Our method is described in the next section. 2.5.2 Trip Duration There has been several research on the trip duration prediction. Kwon et al. (2000) use the flow and occupancy data from single loop detectors and historical trip duration information for to forcasting trip duration on a freeway. Using real traffic data, they found out that simple prediction method can have a good estimation of trip duration for trip starting in near future (up to 20 minutes) while historical data can help better for the trip which starts in more than 20 minutes. The same approach is used in Chien and Kuchipudi (2003). Zhang and Rice (2003a) uses a linear model to predict the short-term freeway trip duration. In their model, the trip duration is varied as a smooth function of departure time. Their results show that for a small data set, the error varies from 5% to 10% while for the bigger data, the variation is from 8% to 13%. Support Vector Regression is used for prediction of trip duration in Wu et al. (2004b). They utilize real highway traffic data for their experiment. They suggest a set of SVR parameter for the prediction which is able to outperform other baseline trip duration prediction model. Balan et al. (2011) is a real-time information system that provide the expected fare and trip duration for passengers. They use historical data consisting of approximately 250 million paid taxi trips for the experiment. But the use of meta-learning for the prediction of trip duration is still missing. In our knowledge, there is no previous work which uses meta-learning for trip duration prediction. Considering the rapid changing of behavior of vehicular network, using a single algorithm for forecasting the travel time will end in unreliable prediction. In addition, using Trial and error to find out the algorithm which fits well to the specific data set (data set for a specific vehicle and in a specific time) would be time consuming and probably is not useful. Part I Data Collection 21 Chapter 3 Data Gathering for Sensing Applications in Vehicular Networks 3.1 Introduction Vehicular ad-hoc networks (VANET) were motivated mainly by safety and traffic management applications, followed by infotainment applications that provide an additional commercial utilization of the new communication infra-structure. Alternatively, we propose to use a VANET as the infrastructure for an urban cyber-physical system, an approach that has not been extensively explored so far. Vehicles equipped with a wide range of sensing devices and the ability to communicate with each other offer a unique opportunity for gathering real-time data about a city, like traffic conditions, environmental parameters, video and audio for surveillance Gerla and Kleinrock (2011), or physical condition of the drivers Rodrigues et al. (2010a). A good overview of existing work on using vehicles or VANET for sensing can be found in Gerla and Kleinrock (2011). Existing VANET solutions either apply on-demand querying for local dissemination within the VANET Lee et al. (2009b), sometimes keeping the data in the location it pertains to Dikaiakos et al. (2007a), or rely on delay-tolerant networking and open Wi-Fi access points for sending the data to the Internet backbone Hull et al. (2006a). However, the first are inefficient for real-time traffic or environmental monitoring due to the query overhead and the need to globally access the data, and the latter cannot guarantee up-to-date data. Knowing the updated state of the various relevant variables for a city is necessary for applications such as navigation using real-time traffic information for regular and for emergency vehicles, or personal mobility and environmental monitoring. The purpose of sensing in the sense of a cyber-physical system is to provide the sensed data to entities outside the VANET in almost real-time. This corresponds to a system architecture where several or all nodes in the VANET are data sources and the ultimate destination of the data lies outside the VANET, whereby data can get there through one or more gateways. This chapter proposes and evaluates a broadcast-based protocol for data collection over VANET. 23 24 Data Gathering for Sensing Applications in Vehicular Networks In scenarios of high node density broadcast storms impair communication in VANET. Several algorithms have been proposed to mitigate them mostly in scenarios of safety message dissemination in highways, with some techniques focusing on reducing the amount of forwarders at each hop using probabilistic forwarding and suppression Tonguz et al. (2007,2006b); Wisitpongphan et al. (2007c), some relying on using exchanged neighbor information to explicitly limit the number of forwarders Sepulcre et al. (2011a). We consider that it is inefficient to continuously exchange neighbor information in a highdensity volatile network for several reasons. First, there is the overhead of periodically exchanging the neighbor list. Second, additional mechanisms must verify whether the chosen forwarder actually forwards the packet. Third, another major reason for not using an explicit choice of a single forwarder is that, in urban scenarios, this choice would require knowledge of the road topology and car density towards the destination to avoid routing packets to a dead-end. And it does not seem feasible to do routing on the road topology on a packet-by-packet basis. Instead, we take the approach of adding the geographic location of current forwarder and the destination to each data packet and use this information at the receivers to rank them as potential forwarders in a distributed fashion on a packet by packet basis. The potential forwarders are differentiated using back-off timers and suppression is used to limit the number of forwarders, extending existing techniques to the urban sensing scenario. We evaluate the proposed protocol using the NS3 simulator for large-scale simulation and compare its performance with well-known broadcast-based protocols in an urban setting. We analyze networking metrics, like the packet delivery rate, the end-to-end delay and the number of hops in the path, as well as the number of replicas that reach the destination, i.e. the redundancy added by the protocol, and the overhead in terms of total amount of packets created in the network. The rest of the chapter is organized as follows: Section 3.2 describes the novel protocol and its parameters. The simulation setup is described in Section 3.3. Section 3.4 shows the results of the performance evaluation of the protocol, and finally Section 3.5 concludes the chapter. 3.2 Broadcast-based Data Gathering Protocol The proposed protocol aims at collecting large amounts of data from sensors installed in vehicles in an urban environment, configuring a cyber-physical system for an urban area. We envision that vehicles move within the urban environment and collect information like pollution or traffic conditions and that the data generated in each node is periodically sent to a back-office using the VANET as sensing infra-structure. In this scenario, we have many-to-one communication pattern from sources to the final destination and we assume that each node knows its own geographical location information and that of the final destination. The goal of the data gathering protocol is to collect this data with high packet delivery ratio (PDR), limited delay and low amount of overhead using a VANET. It is more critical in a scenario where all nodes are data sources than in other VANET scenarios to avoid congestion collapse by limiting the amount of packets forwarded in the network. 3.2 Broadcast-based Data Gathering Protocol 25 We propose Back off-based Per-hop Forwarding (BPF), a data gathering protocol that uses the location information to select the forwarding order among the nodes receiving the packet by mapping it into back-off time, so that nodes likely to be nearer to the final destination have shorter back-off times. BFP has the following properties: 1) it does not require nodes to exchange periodic messages with their neighbors communicating their locations for keeping low the management message overhead; 2) it uses geographic information about the current sender and the final destination node in the header of each data packet to route it in a hop-by-hop basis; 3) it takes advantage of redundant forwarding to increase packet delivery to a destination. The novelty of this protocol is the use of the final destination for per-hop forwarding in a unicast urban scenario. It takes advantage of the geographic location of the destination to direct the forwarding towards the destination, being more efficient than destination-agnostic protocols commonly used for safety message dissemination. Moreover, it takes advantage of redundancy to be more effective than protocols that specify one single forwarder, since specifying one single per-hop forwarder in an urban environment requires additional knowledge of the full street map towards the destination, or the chances are high that a packet is routed to a dead-end or along a very long route. 3.2.1 BPF Protocol Design Figure 3.1 illustrates the scenario in considered to explain the calculation of the per-hop back-off time: node iis the previous hop for node jand nodes 1, 2 and jare potential forwarders. Figure 3.1: Node configuration used for calculations The most straightforward choice for forwarding is the node geographically closest to the final destination Karp and Kung (2000b), but that information is not available when neighbor nodes do not exchange their locations with each other. So, the preferred forwarders are the nodes that represent the most progress from the previous sender, which are the nodes located closer to the end of the transmission range, which is taken by protocols like Contention Based Forwarding (CBF) or the 1-persistent broadcasting. We further reduce the number of forwarding nodes using the distance to the final destination in the component of the back-off calculation. 26 Data Gathering for Sensing Applications in Vehicular Networks Usually, there are 2 constant values used to calculate the back-off time: Di j and dj. These values are the distance to the last hop and to the final destination, respectively. To analyze the effect of these two constant on the back-off time, we define two different components according to these values in this section: C1and C2. The first component is the distance between current node (j) and previous hop (i), Di j, compared with the average communication range (R). By selecting nodes farther from the previous node to forward sooner than other nodes is a receiver-based greedy approach that makes packets travel the largest possible distance at each hop. We define the following component, which selects a node at the end of the communication range to have lower back-off time than other nodes: C1= (1−Di j R)(3.1) However, we wish to further concentrate the preferred forwarders in the direction of the final destination, since nodes at the end of the communication range in the opposite direction of the final destination can cause a useless increase in the number of replicas (in Figure 3.1 node 1 is in this situation). The second component in the calculation of the back-off time is the distance to the final destination, dj, relative to the distance between the previous hop and the final destination, di: C2= (1.0+d j −di −R 2R)(3.2) Figure 3.2 shows the back-off time calculated as a combination of C1and C2. In these plots, the previous node is located at (0,0), the final destination is at (2000,0)(horizontally to the right of the plot) and the communication range equals 500 m. The first plot depicts the back-off as an equally weighted sum of both components, while the second plot considers only C2. The initial plot shows only little directionality towards the destination, because theC1component is dominant in the sum due to the fact that Di j is much larger than dj−di−Rexcept when the nodes are very close to the destination. Therefore, for the evaluation of the BPF, we only consider the calculation based on the C2component. 3.2 Broadcast-based Data Gathering Protocol 27 −1000 −800 −600 −400 −200 0 200 400 600 800 1000 −1000 −800 −600 −400 −200 0 200 400 600 800 1000 x y 0 500 1000 1500 2000 2500 3000 3500 (a) C1and C2 −1000 −800 −600 −400 −200 0 200 400 600 800 1000 −1000 −500 0 500 1000 x y 0 1000 2000 3000 4000 5000 6000 7000 8000 (b) C2only Figure 3.2: Back off time in microseconds for different positions around a node located at (0,0) according to C1and C2. Location of the final destination (2000,0)(horizontally to the right of the plot) and communication range is 500 m. 34 Data Gathering for Sensing Applications in Vehicular Networks 2.4 4.8 7.2 9.6 0 1 2 3 4 5 Average No. of Replicas per uniquely received packets Node Density[nodes/km ] BPF slotted−0.5 slotted−1 weighted−p 2.4 4.8 7.2 9.6 0 1 2 3 4 5 Average No. of Replicas per uniquely received packets Node Density[nodes/km ] Figure 3.7: Average Number of replicas per uniquely received packets for 4 different protocols with 8 sources (20kbps) 3.4.4 Scaling Source Nodes Since we envision a scenario where all nodes can be data sources, Figure 3.8 shows the PDR% for increasing percentage of nodes being network sources in the highest node density (9.6 nodes/km) scenario previously considered. As expected, as the number of source nodes in the network increases, the PDR% decreases due to increasing network congestion. Nevertheless, the proposed protocol shows a higher PDR% in all situations, showing a higher efficacy. As a future work, we will study a way to increase the PDR% for high node density having all nodes as source nodes by decreasing the number of useless forwarding. 3.5 Summary 35 10 20 50 100 0 20 40 60 80 PDR% Percentage of source nodes[%] BPF slotted−0.5 slotted−1 weighted−p 10 20 50 100 0 20 40 60 80 PDR% Percentage of source nodes[%] Figure 3.8: PDR% for different number of source with 9.6 nodes/km 3.5 Summary We envision the usage of a VANET as an infra-structure for an urban cyber-physical system that makes available up-to-date data about various parameters of an urban area to services outside of the network. The main consumers of such data are applications like as traffic management or navigation using real-time traffic information for regular and for emergency vehicles, or personal mobility and environmental monitoring. The data gathering system is modeled as a many-to-one communication over VANET, a scenario that has not been previously addressed. In this scenario, broadcast storms are more likely to happen than in regular scenarios, since there are more source nodes regularly sending packets, so the amount of congestion in the network should be carefully monitored. In this chapter, we propose the Back off-based Per-hop Forwarding (BPF), a broadcast- and receiver-based per-hop forwarding protocol that selects the forwarding order among the nodes receiving the packet by mapping it into back-off time, so that nodes likely to be nearer to the final destination have shorter back-off times. BFP has the following properties: 1) it does not require nodes to exchange periodic messages with their neighbors communicating their locations for keeping low the management message overhead; 2) it uses geographic information about the current sender and the final destination node in the header of each data packet to route it in a hop-by-hop basis; 3) it takes advantage of redundant forwarding to increase packet delivery to a destination. 36 Data Gathering for Sensing Applications in Vehicular Networks We evaluated the proposed protocol and compared its performance to broadcast storm mitigation techniques for safety message dissemination using ns-3. The results show that the proposed protocol achieves higher packet delivery rates and uses on average the same number of hops and causes less redundant packets at the data sink. When subject to increasing load due to increasing number of nodes generating data, all studied protocols significantly reduce the PDR%, although BFP maintains a higher delivery efficacy. However, the results also indicate that there is still room for improving the performance in higher load scenarios, which will be the focus of the next steps. Another matter of interest in this context is analyzing the effect of the length of the path between sources and destinations and limiting the amount of network congestion observed near the sink, a typical problem from sensor networks. Chapter 4 Supporting Sensing Application in Vehicular Networks 4.1 Introduction Vehicular ad-hoc networks (VANET) have moved into the spotlight driven mainly by the benefits expected from safety, traffic management, and infotainment applications Gerla and Kleinrock (2010). In this chapter, we propose a different utilization, namely to use a VANET as the infrastructure for an urban monitoring system, an approach that has not been explored so far. Vehicles equipped with a wide range of sensing devices and the ability to communicate with each other offer a unique opportunity for gathering real-time data about a city, like traffic conditions Hao (2010), environmental parameters, video and audio for surveillance Gerla and Kleinrock (2011), or physical condition of the drivers Rodrigues et al. (2010b). Knowing the updated state of relevant variables for a city is not only critical for applications such as navigation using real-time traffic information both for regular and for emergency vehicles, but also for personal mobility support and environmental monitoring Rodrigues et al. (2011a). The IEEE has recently released the 802.11p standard for VANET IEE (2010), which is derived from the 802.11a and 802.11e standards. The 802.11p PHY uses the 5.9 GHz frequency band with channels of 10 MHz. Additionally, 802.11p MAC does not require node association for communication, and no handshakes or acknowledgments are foreseen on the control channel. The purpose of urban sensing is to provide information about an urban area to entities outside the VANET in near real-time. Each node collects information about its environment and sends it periodically to the gateway, configuring a many-to-one network topology, where all nodes are simultaneously both data generators and forwarders and the ultimate destination of the data lies outside the VANET. Several protocols for data collection in wireless sensor networks (WSN) and mobile ad-hoc networks (MANETs) have been previously proposed, but VANET links are more volatile and multi-hop paths have very short durations Viriyasitavat et al. (2011), in addition to the lack of reliability at the link level due to the highly dispersive environment. In this scenario, the protocols 37 38 Supporting Sensing Application in Vehicular Networks developed for WSN incur a very high path management overhead Li et al. (2009) and are not adequate. On the other hand, existing VANET protocols focus on unicast or data dissemination, and the scenario described has not been previously addressed. This chapter proposes and evaluates a data collection protocol over an urban VANET. Our main contributions are 1) a new data collection protocol for data gathering in an urban area; 2) the evaluation of different suppression levels to limit the number of forwarders at each hop; 3) the benchmarking of broadcast-based protocols using a metric appropriate to measure sensing performance. Our results show that significant gains can be obtained from probabilistic forwarding to further reduce the replication of packets at each hop while there is a significant amount of packets from each road segment received at the gateway for a wide range of vehicle densities. 4.2 Data Collection Challenges The envisioned scenario is a city environment with moving cars which are collecting sensor data about the city, e.g. noise or air pollution, and the VANET is used as sensing infrastructure for gathering and sending the data to a back-office outside the VANET for monitoring purposes. This configures a many-to-one communication pattern, and it is assumed each node knows its own geographic position and that of the gateway. In a city, cars move along the streets with unpredictable patterns and buildings block the communication between vehicles in non-aligned streets, creating a very volatile environment, where a single direct link lasts on average 20 s Viriyasitavat et al. (2011). Data collection protocols for wireless sensor networks and MANETs foresee some movement and provide mechanisms for path re-establishment, but they would need to be used too often in such volatile scenarios causing too high an overhead. On the other hand, the number of vehicles in each street segment is highly variable in time and across different streets, and not feasible to be estimated in real-time by vehicles in other streets with low overhead. This makes it difficult to use source routing to take the packet towards the destination, because it is not possible to know at the packet source, or anywhere along the way, whether there are vehicles that can serve as forwarders in the street segments between any vehicle and the gateway, causing packet die out with high likelihood. Furthermore, during traffic congestion, communication can be very difficult due to an overly loaded shared medium. In this situation, which is common in urban areas, requiring additional message exchange for coordination purposes increases further the medium load. A protocol for data collection in an urban scenario using vehicle-to-vehicle communication must take all these limitations into account. 4.3 Protocol Design 39 4.3 Protocol Design The proposed protocol is Urban Data Collector (UDC) protocol, a data gathering protocol that has the following features: 1) it does not require nodes to exchange periodic messages with their neighbors; 2) it uses the 802.11p MAC layer; 3) it takes advantage of redundant forwarding to increase packet delivery to the gateway; 4) it limits the amount of redundancy using suppression techniques. The UDC protocol is a network layer protocol that can be run on top of the recently standardized 802.11p MAC. It is a broadcast- and receiver-based protocol, so that it can take advantage of any node that receives a forwarded packet without requiring an exchange of information about node present in the neighborhood. This is especially relevant because the MAC layer does not provide acknowledgments, and it is not easy for a forwarder node to know whether its packet has been received by another node. Next, we exemplify why some well-known solutions are not adequate for data gathering in urban areas, and explain how our protocol addresses those issues. Figure 4.1: UDC help packets to get to the gateway when a path in the direction of gateway is blocked by a building. Figure 4.1 illustrates a case where a greedy protocol cannot deliver a packet to the gateway (shown as an antenna on the right bottom) because a chosen forwarder does not have any neighbor in the direction of the gateway. Protocols like GPSR Karp and Kung (2000a) use perimeter routing technique to recover from the blocked path and find another path to the gateway, but these 40 Supporting Sensing Application in Vehicular Networks introduce a high delay and cause a lot of additional transmissions. Because the proposed protocol follows two paths simultaneously (black and gray paths in Figure 4.1), although the black path is blocked, the gray path provides a redundant path which avoids packet die out. Figure 4.2: UDC avoid packet die out when an accident happens on the direction of the gateway. In Figure 4.2, the main path (black path) to the gateway is blocked because the packet reaches a node that has no other nodes in range. This can happen because of the high volatility of the network, where the node that sent the packet is no longer in range after the routing dead-end has been detected. In this case, the perimeter technique will not be able to recover from this situation because there are no other nodes in the communication range of the single vehicle that has the packet. Because our protocol uses both the main path (black path) and the redundant path (gray path) for forwarding the packet the likelihood of both dying out is reduced. Existing protocols get stuck in a blocked road or a road without forwarders toward the gateway because most of them take a binary decision for selecting the next forwarder. UDC gives the forwarding opportunity to several neighbor nodes to create redundant paths to avert packet die out. Finally, a fully distributed suppression technique that requires no coordination among nodes has been used to limit the number of redundant paths so as to reduce the overhead. This is accomplished by taking advantage of two different types of forwarding: directional forwarding and probabilistic forwarding. Directional forwarding means that each node, upon receiving a packet, 4.3 Protocol Design 41 forwards it in the direction of the gateway after the expiration of a timer, which is used for giving forwarding priority to nodes that represent more progress towards the gateway. Probabilistic forwarding means that each node forwards the received packet with a probability which depends on difference distances between itself and the previous node to the gateway. The next sections describe in detail how these two techniques are combined to provide the desired functionality. 4.3.1 Directional Forwarding UDC uses a network layer timer calculated as a function of the difference between the distance of the previous and potential forwarder to the gateway to prioritize forwarders nearer to the gateway. The timer is calculated at each node in a distributed manner based only on the information contained in the header of the received packet and of the node itself. Figure 4.3: One-hop forwarding entities Figure 4.3 illustrates the scenario used to explain the calculation of the timer: node iis the sender of the packet and nodes 1, 2 and jare receivers and potential forwarders. The communication range is divided into two different areas, marked white and gray in Figure 4.3. Nodes in the gray area are nearer to the gateway than the previous hop, whereas nodes in the white area are farther away. Nodes that represent the most progress towards the destination should be preferred forwarders. These are the nodes located closer to the end of the transmission range in the direction of the gateway, hence, they shall have shorter timers and forward earlier than nodes farther away from the gateway. The time coefficient is calculated according to Equation 4.1. This timer coefficient lies in range [0, 1] and is then multiplied by the maximum timer Tmax to deterministically calculate the actual timer value at all potential forwarders (Figure 4.3). C= (1.0+dj−di−R 2R),(4.1) 42 Supporting Sensing Application in Vehicular Networks where djis the distance of node jto the gateway, dithe distance between the previous hop and the gateway, and Ris the communication range. 4.3.2 Suppression Techniques Suppression techniques are mechanisms that effect the reduction of the number of packets reforwarded at each hop. The simplest suppression mode is that any node that hears a packet being forwarded while waiting for timer expiration stops the timer and discards the packet. In this way, the node that correctly receives a packet and is closest to the gateway will be the first to forward, and any node that hears that forwarding will not double forward. But nodes on different sides of the previous hop may not hear each other, i.e., nodes in the white area do not hear nodes in the gray area in Figure 4.3 and cause duplicated forwarding. This problem could be solved by limiting the forwarder nodes to nodes that are nearer to the gateway than the previous hop. But this is likely to raise a problem for low node density, causing packet die out in the more likely event of lack of a forwarder nearer to the gateway. Four different levels of suppression have been studied to overcome these problems: basic, weak, moderate and strong suppression. In the basic method, nodes discard a packet if they receive the same packet during the timer or wait time (see Section 4.3.3), meaning that it has been forwarded by a node which is closer to the destination. In weak suppression, UDC reduces the number of forwarders by using probabilistic forwarding for the nodes with higher distance to the gateway (white area in Figure 4.3), while nodes closer to the destination (gray area in Figure 4.3) forward the packet with probability one. Nodes in the white area forward a packet with a probability that decreases with increasing distance to the gateway, calculated according to Eq. 4.2. pf wd = (1.0−dj−di R)(4.2) In strong suppression, nodes in the gray area, which are ranked by a timer, forward the packet with a different probability, calculated according to Eq. 4.3 and nodes in the white area do not forward the packet at all. pf wd = (di−dj R)(4.3) An intermediate level, moderate suppression, is added for which the forwarding probability is increased linearly with decreasing distance of potential forwarders to the gateway, calculated using Eq. 4.4. pf wd = (di−dj+R 2R)(4.4) Figure 4.4 shows the forwarding probability of different suppression levels where the x-axis shows the difference distance between the last hop and potential forwarders to the gateway (di−dj) relative to the communication range (R). 4.3 Protocol Design 43 −R R 0.2 0.4 0.6 0.8 1 [m] Forwarding Probability Basic Weak Strong Moderate Figure 4.4: Forwarding Probability calculated for different suppression techniques The complete network layer forwarding protocol algorithm is described in Figure 4.5. Upon receiving a packet, node checks if it is not a gateway and consequently if it did not receive the packet before, it calculates the timer (section 4.3.1) and in the end of the timer according to the probability (section 4.3.2) forwards the packet. Chapter 5 Numerical Limits for Data Gathering in Wireless Networks 5.1 Introduction Data collection is a major application of wireless sensor networks. Typically, each node in the network captures information about its environment through sensors and sends it towards the sink node, which has all resources and functionalities to store and/or process the data. All nodes are also relays, helping data from other nodes get to the sink. In this scenario, it is crucial to know the maximum amount of data that each node can produce without causing the network to overload. In this chapter, we provide initial numeric results on the limit of wireless data gathering along a chain with respect to the probability of collisions due to hidden nodes. The scenario for this calculation is many-to-one communication from all nodes in the chain to the sink. To the best of our knowledge, there are no previous results that enable the calculation of a numeric limit for the data generated by each node as a function of the network parameters. The lack of such a calculation motivates us to show the limitation of the network in a chain of nodes with some numerical results. In this study, we focus on the maximum service rate at each node for achieving a certain packet delivery rate at the sink. For example for a chain of 15 nodes, for having guaranteed 90% packet delivery for each node at the sink, the service rate must be less than 25%. The rest of the chapter is organized as follows. The network model which has been used for our calculation is illustrated in Section 5.2. The main contribution for limitation of the data gathering is shown in sections 5.3 and 5.4. Section 5.5 shows the results for two well-known performance metrics: packet delivery rate (PDR) and service rate. Results are discussed in section 5.6. In Section 5.7, we verify our calculation by simulating the same scenario. Finally, we conclude the chapter in Section 5.8. 51 52 Numerical Limits for Data Gathering in Wireless Networks 1 2 3n-1 n Sink Communication range Figure 5.1: Network model 5.2 Network Model According to our previous study for an urban scenario Nozari Zarmehri and Aguiar (2011), each source passes its packets through a chain of nodes to the sink. So we consider a network model deployed as a flat chain of nnodes, which are all data sources. Also, there is one sink node, located at the end of the chain, which we will consider to be at the right side without loss of generality. Each node is not only a source of data packets but also a relay for the data coming from all its left side neighbors on its way towards the sink. The network model used for the calculations is illustrated in Figure 5.1. Each node has at most two neighbors located at the end of its transmission range. Moreover, nodes forward all packets received from the left side and ignore all packets received from the right side (implied ranking). The channel transmission rate is W[bps] and the packet transmission duration is τ, and can be calculated as τ=L/W, where Lis the packet size. 5.3 Maximum Service Rate without Collisions In this section, we calculate the maximum service rate as the maximum amount of data that can be generated at each node. The actual generation rate should be less than the maximum achievable service rate to avoid overload. We make the simplifying assumption that nodes send their packets in a coordinated way from left to right, starting at the farthest node from the sink, and each node sends one packet of its own and forwards one packet from each node in its left, adding up to i packets at node i. All nodes use the same amount of resources, time, for sending each data packet, τ, so node ineeds i·τto transmit its packets. We also assume that each node requires a certain time to access the channel for each transmission, the channel access time TCA, which is on average equal for all nodes. Assuming a total available time of T, the first node on the left has T−TCA time for its transmission. But the second node cannot send during the transmission of the first and third nodes to avoid collisions, where the second node has T−TCA −2τtime to send its data packets, which include his own data packet and the data packet forwarded from node one. This calculation can be continued to the end of the chain. Although node nis the last node in the chain, it is not the bottleneck because it must not wait for any transmission on its right side, since there is the sink. 5.3 Maximum Service Rate without Collisions 53 Hence, the bottleneck of this scenario is node n−1 because it is the last node that must avoid collision with neighbors on both sides. The total waiting time for the bottleneck in this scenario is given by the sum of the transmission times of the neighbor nodes, n−2 and n, with the average waiting time: TCA + (n−2)τ+nτ. To accommodate all transmissions from all nodes without collisions, the total available time T should be at least equal to the waiting time plus the time needed for its own transmissions at the bottleneck: T≥TCA +(n−2)τ+nτ+(n−1)τ(5.1) From here, we can calculate the maximum duration of a single packet, τ, depending on the other network parameters as follows: τ≤T−TCA (3n−3)[seconds],(5.2) And the maximum amount of data that can be generated by each node within each period Twithout causing congestion is: L≤(T−TCA)W (3n−3)[bits](5.3) We also calculate the best-case resource usage efficiency, ρ, which can only be obtained through perfect scheduling, by dividing the maximum amount of data that can be transmitted by all nodes per unit time by the available channel bit rate (W): ρ=L·n T·W(5.4) 54 Numerical Limits for Data Gathering in Wireless Networks 0 20 40 60 80 100 30 40 50 60 70 Efficiency [%] No. of nodes in the chain (a) Efficiency 0 20 40 60 80 100 103 104 105 106 Maximum Packet Size [Bytes] No. of nodes in the chain (b) Maximum packet size Figure 5.2: Performance of a simple Chain 5.4 Interference Model 55 Figure 5.2a shows numeric values for the resource efficiency and Figure 5.2b the maximum amount of data per node for T=1 s, TCA=5 ms, and available bandwidth W=6 Mbps. Both values decrease with increasing number of nodes in the chain, as expected. The bandwidth efficiency is below 70% for very short chains and stabilizes at around 35%, and we have not yet considered hidden node collisions. 5.4 Interference Model In the previous section, we assumed that the transmission starts were fully coordinated and node i would only start to transmit after it received all packets from node i−1, in which case no collisions could occur. In this section, we extend the results to a more realistic scenario, in which transmission starts are not coordinated and packet receptions at any node can be impaired by collisions caused by simultaneous transmissions from both neighbor nodes, which cannot hear each other (hidden nodes). This only impairs the packet delivery rate from the left side neighbor, since the data flows from left to right. To estimate the number of collisions and its influence on the system performance we assume a time slotted system, in which the total time Tis divided into Nequal time slots. The minimum number of time slots can be calculated by considering the bottleneck in the network according to Eq 5.5. Node n−1 should wait during the transmissions of nodes n−2 and nto avoid collision, and needs n−1 time slots for own transmission. N= (n−2)+(n−1)+n=3n−3 (5.5) Even with this number of time slots, a collision can still happen when two hidden nodes select the same time slot for a transmission. For example, nodes 2 waits for node 1 and 3 but cannot hear the transmission of node 4 and so it is possible that nodes 2 and 4 select the same time slots for their transmission, causing a collision that impairs the reception of the packet from node 2 at node 3. So, nodes in the chain do not receive all packets generated to their left side, as part of those collide as a consequence of the hidden node problem. Equation 5.6 expresses the total received packets at node n−1, Rn−1, obtained by subtracting the total number of collisions (E[Col]) from node 2 to node n−1 from the total packets generated to the left of the node. Rn−1= n−2 ∑ i=1 ki− n−1 ∑ j=2 Ej[Col](5.6) The best case scenario is when time slot selection is coordinated and no collisions occur, meaning that nodes receive correctly all packets generated at their left side. Therefore, the probability of receiving all packet successfully in node n−1 can be calculated by Equation 5.7. Node n−1 receives successfully all the packets only if it selects its time slots for transmission from all time slots excluding the ones chosen by nodes n−2 and n. 56 Numerical Limits for Data Gathering in Wireless Networks Pn−1[Success f ul] = N−kn−2−kn kn−1 N kn−1(5.7) This calculation is plotted in Figure 5.3a for each node in the chain and for three different chain lengths. The probability of successfully receiving all packets from all nodes decreases as the number of source nodes increases and goes to zero before reaching to the sink for all chain lengths, meaning that it is not possible to receive all packets at the sink without collision. 5.4 Interference Model 57 3 5 7 9 11 13 15 0 0.2 0.4 0.6 0.8 1 Probability of Successfully receive all packets Node ID in chain n=7 n=10 n=15 (a) Probability of receiving packets successfully at each node in a chain 3 5 7 9 11 13 15 0 50 100 150 200 Number of Iterations Expected Number of Collisions 7 nodes 10 nodes 15 nodes (b) Effect of increasing N on the expected number of collision Figure 5.3: Chain Performance 58 Numerical Limits for Data Gathering in Wireless Networks For considering possible collisions in Equation 5.7, which is more realistic, this equation has been extended. We use Yias a random variable that indicates the number of collisions at node i. For example F Y2(0) = P(Y2=0) = P2[Success f ul]or F Y2(1) = P(Y2=1)is the probability of having one collision at node two. The probability of having ycollision at node (n−1) is: F Yn−1(y) = P(Yn−1=y) = N−kn−2−kn+y kn−1−y×kn−1 y N kn−1(5.8) In Equation 5.8, the numerator has two factors. The first factor shows that node n−1 as a receiver has ycollisions. So this node has ycommon time slots with its neighbors. The second part just shows the selection of these collisions from all received packets. 5.5 Results 59 So, the expected number of collision can be calculated for node (n−1) from Equation 5.9: En−1[Col] = kn−2 ∑ i=1 i×F Yn−1(i)(5.9) In the presence of collisions, some of the time slots are used for unsuccessful transmissions. So, to evaluate the effect of increasing the number of time slots on system performance, we iteratively add the total number of expected collisions over all nodes (Equation 5.10) to the number of time slots (N). Thus, we do an iterative search for the number of total time slots required to transmit one packet from each node with high packet delivery rate at the sink. ETotal[Col] = n ∑ i=2 Ei[Col](5.10) NU pdated =3n−3+ETotal[Col](5.11) Figure 5.3-b shows how the expected number of collision is improved by increasing the number of time slots (N). In this figure, each node generates one packet. By increasing N, the expected number of collision decreases (Figure 5.3-b). However, it causes also a decrease in the service rate. 5.5 Results 5.5.1 End-2-End PDR% Following our previous work Nozari Zarmehri and Aguiar (2012), the most interesting metric for an urban data collector (UDC) protocols is the number of packets received at the sink (PDR%). Moreover, this packet delivery ratio is considered between each source and the sink (End-to-End) because we assume that the sensing application needs information from each source to create a macro vision about the city. According to Equation 5.6, collisions are the main reason of PDR% reduction at the sink. Figure 5.4 shows the PDR% at the sink for a chain with varying number of nodes. The average number of hops from each source node to the sink in our previous study Nozari Zarmehri and Aguiar (2012) was between 10 to 15 hops, so we focus on this chain length range. The plot shows the end-to-end PDR% for various chain lengths, calculated for the farthest node from the sink, as it is the worst case PDR. Table 5.1 shows the number of time slots in each iteration for each configuration. For 10 nodes, after 12 iterations, there is no collision and the number of time slots remains the same. It also happens for 15 nodes after 10 iterations. Therefore, the curves for 10 and 15 nodes in figure 5.4 reach to the 100% and cross other curves. Part II Data Management for Modeling 67 Chapter 6 Improving Model Performance by Using Existing Hierarchies in the Data Traditionally, Data Mining (DM) applications use a single model. This model is created by applying an algorithm on all the data available, or a carefully selected part of it. For example, a single model has been used to predict the trip duration in public transportations Mendes-Moreira et al. (2012). However, in a VANET, data is collected in different settings and the transmission of data is costly. This discourages the construction of a single dataset with all the data. Furthermore, the phenomenon that is under analysis may also vary dramatically with vehicles (e.g. taxis that work regularly in an airport as opposed to the ones that work in the city center), which means that the best model may vary with the vehicle. Therefore, different learning processes must be used (i.e. different datasets, different algorithms and/or different parameter settings) for different vehicles. On the other hand, although there is a cost associated with exchanging data, the use of data from different vehicles may, in some cases, yield gains in predictive performance that compensate for that cost. For instance, a taxi in a small town may not generate enough data to obtain reliable models and, thus, it may compensate to join its data with data obtained from others. All of this means that, in order to maximize the quality of the results, the learning process involves selecting: •the training data, i.e. local or collect data from other vehicles, •the algorithm, i.e. the learning method with the most suitable bias for the data, •the parameter settings of the algorithm, i.e. the values of the parameters of the selected algorithm that will yield the best model. Although the number of data sources in traditional DM projects is significantly smaller than in the context of VANETs, a parallel can be established in some settings. Traditional projects often work on the raw data obtained from the transactional systems, such as the Enterprise Resource Planning (ERP) and Customer Relationship Management (CRM) systems. Many companies also 69 70 Improving Model Performance by Using Existing Hierarchies in the Data have Business Intelligence (BI) systems that collect and organize the data from the same systems Kimball et al. (2011). The data is used to compute metrics that represent the performance of the business processes (e.g. sales or new customers acquired). The metrics are stored in a Data Warehouse (DW) and are organized into dimensions (e.g., product taxonomy and store location). These dimensions have different granularity levels (e.g., store location can be analyzed at the street, city, region and country level). In this setting, DM models can be generated at different levels of granularity (e.g. customer, product, store). Traditionally, DM algorithms were applied at the global level. For instance, a single model 1was learned to make sales predictions for all products. However, as more data is collected and the data characterizes objects at a finer level, there is a growing interest in more specific models, that represent groups or individual entities Soulié- Fogelman (2006). For instance, we may learn a direct marketing model for each segment of clusters or a sales prediction model for each individual product. Assuming that the data available is sufficient to generate models at different levels of granularity, the choice is usually based on some domain-level knowledge. For instance, in an application to detect errors in foreign trade transactions, approaches have been attempted where the modeling is done at the global level or at the local level Soares et al. (1999); Torgo and Soares (2010). However, this choice may not yield the best local models in every case. Thus, as in the case of VANETs, there is an opportunity to maximize the quality of results by selecting for each learning process, the training data, the algorithm and its parameters. Before proposing a methodology to address this problem, we investigate empirically if a real application confirms the existence of such an opportunity. The hypothesis is whether the best results are obtained by learning different local models using different learning algorithms on training data obtained at different granularity levels. However, the VANET data available for this project does not allow the testing of this hypothesis at a detailed level, due to the lack of timestamps in the observations. Therefore, we test the hypothesis on a traditional DM problem with the characteristics that were indicated earlier: observations are organized hierarchically using a simple DW dimension. Thus, in this chapter we argue that the DW schema, namely the hierarchy associated with the dimensions, can be used to support the selection of the granularity that should be used to develop the DM models. Furthermore, we argue that for different parts of the problems (e.g. different products), the best granularity level may vary. The problem is concerned with the use of outlier detection methods to detect errors in foreign trade data Soares et al. (1999); Torgo and Soares (2010). The description of the data and previously obtained results with this data are presented in Section 6.1. Section 6.2 describes our proposal for outlier detection using different granularity levels of the product hierarchy. We then present the evaluation of the proposal in Section 6.3. Finally, Section 6.4 concludes the chapter. 1For simplicity, we include multiple model approaches, such as ensemble learning, when we refer to ”single model”. 6.1 Background 71 Table 6.1: Dataset features Feature Name Description RN Row Number Origin (O) Type of method used to insert the data into the dataset (1: Disk, 2: Manual, 3: Web) In/Out (IO) The flow (1: arrival, 2: dispatch) Lot number (L) Group of transactions that were shipped together Document number (DN) Official document number Operator ID (OID) Company that is responsible for the transaction Month (M) Month of the transaction Line number (LN) Line number in the document Country (C) Country of origin/destination Product code (PC) Code of the product Weight (W) Weight of the traded goods Total cost (TC) The total cost of the traded goods Type import/export: (1: Import, 2: Export) Cost/Weight (TCW) The ratio of Total cost per weight Average Weight/Month (AvgWM) Average weight of the transactions made in the same month of the product which the current transaction is from Standard Deviation of Weight/Month (SDWM) Standard deviation of AvgWM Score (S) normalized distance of the Total cost/weight value to the average value Soares et al. (1999) Transaction number (TN) Number of transactions made in the same month of the product which the current transaction is from Error (E) target value (1: error, 0: normal transaction) 6.1 Background In this section, we start by describing the dataset of foreign trade transactions used in this work. Then, we describe the previous results obtained on that dataset. 6.1.1 Foreign Trade Dataset The data which is used in this chapter is the foreign trade data collected by the Portuguese Institute of Statistics (INE). Users from Portuguese companies fill in forms about import/export transactions with other EU countries, containing several pieces of information about those transactions. They may insert incorrect data when filling the form. Some of the common errors are declaring the cost in Euro rather than kEuro; the weight in grams instead of kilos; and associating a transaction with the wrong item. At INE, the experts extend the dataset with a few other attributes. The most important of those attributes, in terms of error detection, is the Total Cost/Weight. This attribute represents the cost per kilo. The experts typically detect errors by analyzing this value first and then, eventually, other fields. The dataset contains the following information Soares et al. (1999)(see Table 6.1): 72 Improving Model Performance by Using Existing Hierarchies in the Data 6.1.2 Goals and Previous results The success criteria originally defined by the experts for the automated system is: •The system should select less than 50% of transactions, •The selected transactions should contain more than 90% of the errors. In the first approach to this problem, four different outlier detection algorithms were applied Soares et al. (1999): box plot J.S. Milton, J.J. Corbet (1997), Fisher’s clustering algorithm Fisher (1958), Knorr & Ng’s cell-based algorithm Knorr and Ng (1998), and C5.0 Quinlan (1998). The best results were obtained with C5.0. A scoring approach was used, which orders the transactions according to the probability of being an outlier. The model obtained with C5.0 was able to identify 90% of the errors by analyzing 40% of the transactions. Fisher’s algorithm using the Euclidean distance and identifying 6 clusters detected 75% of the errors by selecting 49% of the transactions. The approach based on clustering was further explored more recently Loureiro et al. (2005). In this work, several hierarchical clustering methods were explored. The transactions allocated to small clusters are selected for manual inspection. The results show that the performance of the algorithm depends on the distance function used. The best performance was obtained with the Canberra distance. 6.2 Error Detection Methodology In this section, an exploratory data analysis is done in Section 6.2.1. Then, we describe the use of an outlier detection algorithm for predicting the erroneous transactions in the foreign trade dataset in Section 6.2.2. Finally, the evaluation methodology and metrics use for the evaluation are described in Section 6.2.3. 6.2.1 Data Preparation and Exploration In INE dataset, each product is presented by a unique 8-digits code. For better illustration, a small sample of the dataset is presented in Table 6.2. It contains one transaction from each of the months January, February, March, May, June, August, September, and October in 1998 and January and February in 1999. The 8-digits code can be decomposed to create the data hierarchy. Level 1 is defined by 8- digits, which means that individual products are identified using the 8-digits code. All products that have the same 6-, 4-, and 2-digits belong to the same level 2, 3, and 4, respectively. For better illustration, the existing hierarchy in the product codes starting with 11 is shown in Figure 6.1. The categories for levels one and two are just shown for product codes starting with 1129 for simplicity. As expected, the number of different categories increases by going down in the hierarchy structure because each level contains multiple product categories/codes from the level beneath it. 6.2 Error Detection Methodology 73 Table 6.2: Illustrative sample of the dataset RN O IO L DN OID M LN C PC W TC TCW AvgWM SDWM S TN E 1 2 2 1001 10001 1727 1 1 11 85411650 10 7 739 2.435 3315.93 0.5114699 75 0 2 2 2 1001 10001 1727 1 4 3 49794616 2000 4497 2248 21.711 48369.10 0.4023847 12 0 3 2 2 1001 10001 1727 1 5 11 49794616 25 22 892 21.711 48369.10 0.4304191 12 0 4 2 2 1001 10001 1727 1 8 11 60786650 2 2 1117 27.904 17155.10 1.5614917 4 0 5 2 2 1001 10001 1727 1 10 11 60770400 1 1 1640 0.6697 418.278 2.3197148 7 0 6 2 2 1001 10002 5293 1 1 11 83134627 35 299 8572 15.754 8061.60 0.8908902 3 0 7 2 2 1001 10002 5293 1 2 11 83137027 50 609 12137 10.429 6026.43 0.2832658 50 0 8 2 2 1001 10002 5293 1 3 11 83788501 343 3685 10735 9.493 5167.60 0.2403615 33 0 9 2 2 1001 10002 5293 1 4 11 83784016 1891 19824 10482 13.201 7144.85 0.3806161 9 0 10 2 2 1001 10002 5293 1 5 11 83780035 1644 16492 10033 9.558 4724.45 0.1005249 40 0 RN: Row Number O: Origin IO: Input/Output L: Lot Number DN: Document Number OID: Operator ID M: Month LN: Line Number C: Country PC: Product Code W: Weight TC: Total Cost TCW: Total Cost / Weight AvgWM: Average Weight per Month SDWM: Standard Deviation of Weight per Month S: Score TN: Transaction Number E: Error 74 Improving Model Performance by Using Existing Hierarchies in the Data Figure 6.1: An example of existing hierarchical structure within the data set: Product codes starting with 11 and for simplicity only show the product codes starting with 1129. An important fact about this problem is that it is very unbalanced, as is typical in anomaly detection problems Chandola et al. (2009). There are very few errors: less than 1% of the transactions are erroneous. A summary of the datasets used for the experiment is shown in Table 6.3. The number of categories in each month varies between 3411 to 4697 categories. Actually, these numbers are the number of unique product codes at the first level (common 8-digits). On average, there are around 9 to 16 observations for each category at the same level. Obviously, at the higher levels, the number os observations is higher than this level due to aggregation (Figure 6.2). Another fact about the data is that there are a few errors in each month which is less than 1% percentage for all months. For example, the number of categories in August were 4522, 3032, 963, 94 for level 1 (8- digits), 2 (6-digits), 3 (4-digits), and 4 (2-digits) respectively. Considering all months, the maximum number of categories are 4697, 3109, 972, 95 for levels 1, 2, 3, and 4 respectively, and the corresponding minimum values are 3411, 2449, 833, 90. 6.2.2 Error detection method To find the errors, an outlier detection algorithm is applied at each level of hierarchy for each product code. We used the LOF Breunig et al. (2000) algorithm. The LOF algorithm computes the density of each object in terms of the distance to its k-closest neighbors. If the local density of an object is less than of its neighbors, then the object is considered to be an outlier Breunig et al. (2000). Rather than a label of outlier or non-outlier, LOF computes for each observation an outlierness score. 6.2 Error Detection Methodology 75 Table 6.3: An exploratory data analysis for datasets Number of The percentage of The average number Month categories at No. of errors errors per total of examples for the first level transactions each category 9801 3411 79 0.24 9.36 9802 3757 109 0.27 10.47 9803 3884 150 0.33 11.25 9805 4251 158 0.29 12.33 9806 3697 173 0.45 10.12 9808 4522 130 0.20 13.93 9809 4697 189 0.24 16.36 9810 4249 258 0.44 13.37 9901 3662 256 0.65 10.46 9902 3763 158 0.37 11.13 We used the implementation available from the DMwR package Torgo (2010) of R R Core Team (2014a). The number of neighbors that is used in the calculation of the local outlier factors is k=5. Afterward, in our approach, we use the outlier scores and sort them in ascending order. The first (lower) quartile is the median of the first half of the data (Q1), the second quartile is the median, and the third (upper) quartile is the median of the second half of the data (Q3)J.S. Milton, J.J. Corbet (1997) (see Figure 6.3). The following equation shows the Interquartile Range (IQR)6.1: IQR =Q3−Q1 (6.1) 82 Improving Model Performance by Using Existing Hierarchies in the Data 6.3.3 Personalized Data Selection is Required for Optimal Results The average results presented in the previous section, clearly show that the best results are obtained by analyzing the data at different levels of granularity, as defined by the hierarchical structure which is used to organize the products. Thus, it can be expected that the global results can be improved by selecting for each individual entity (i.e. product in the current case) the level in which it should be analyzed. 6.3.3.1 Best Level According to Single Criterion In fact, the illustrative examples presented in Table 6.5, where the effort for several product codes at different levels of the hierarchy is given, provide additional evidence supporting our hypothesis. The optimal selection for each product is the lowest obtained effort amongst all four levels. Clearly, the best selection is varied for different products. Therefore, modeling at the same level for all product codes does not lead to the best results and may cause a performance degradation. Table 6.5: Illustrative results for effort obtained by applying the method at different levels of the product hierarchy. The optimal selection is the lowest effort amongst 4 levels. Product Level 4 Level 3 Level 2 Level 1 Code (2-digits) (4-digits) (6-digits) (8-digits) 09751691 0.09 0.07 0.13 0.23 33292727 0.08 0.11 0.11 0.11 88065114 0.13 0.20 1.00 1.00 44325116 0.08 0.07 0.14 0.05 85224327 0.10 0.09 0.12 0.12 82225014 0.10 0.06 0.10 1.00 23290416 0.13 0.13 0.15 0.14 49391616 0.10 0.13 0.07 0.06 49395127 0.10 0.13 0.20 0.20 44224327 0.08 0.12 1.00 1.00 44321416 0.08 0.07 0.12 0.11 44751627 0.08 0.14 0.11 0.11 44142716 0.08 0.20 0.20 0.08 44531627 0.08 0.11 0.13 0.13 30680327 0.16 0.11 1.00 1.00 30294327 0.16 0.14 1.00 1.00 The average results for each month are also calculated and shown in Table 6.6. For each product, the optimal effort is calculated and then its related recall at the selected level is found. Suppose that the best effort for product code iis obtained from level 2. So the best level for this product code in our model is C2 i. Then the recall for the same level (C2 i) is selected. The process is repeated for all products in a given month and the average is presented the Table 6.6. This procedure is also done for the best recall and the related effort at the same level. 6.3 Results 83 Figure 6.11: The average best effort with respective recall for each month Figure 6.12: The average best recall with respective effort for each month The average of best effort for all months is always below 10% (Figure 6.11) and the average of best recall is also over 99% (Figure 6.12). Both results are within the limits of acceptance that were defined by the experts. However, if we take both criteria into account, effort and recall, neither of the strategies presented here, i.e. focusing on either effort or recall, achieves acceptable results. Table 6.6 shows that in the optimal effort strategy, the corresponding average recall is always below 90%. The scenario for the optimal recall strategy is better, as there are several months with a corresponding average effort below 50%, but in the majority of the cases, the effort is above the established maximum. In summary, the results are not acceptable by the experts in both cases. Thus, a better strategy is needed. Table 6.6: The average result for the best effort and its related recall and the best recall and its related effort. Month Optimal Recall relative Optimal Effort relative effort to the recall to the optimal effort optimal recall 9801 8.31 86.85 99.73 26.83 9802 8.10 85.72 99.69 23.45 9803 7.85 81.27 99.60 71.61 9805 7.61 85.15 99.49 68.74 9806 8.33 78.68 99.34 54.23 9808 7.56 83.55 99.59 20.76 9809 7.08 81.93 99.31 60.81 9810 7.70 80.25 99.19 67.42 9901 8.22 72.58 99.01 73.25 9902 8.61 77.78 99.44 26.89 84 Improving Model Performance by Using Existing Hierarchies in the Data Figure 6.13: The average effort in each month when the training data is always selected from: The best level (Dark Green), Level 4 (Light Green), Level 3 (Gray), Level 2 (Yellow), or Level 1 (Red) Figure 6.14: The average recall in each month when the training data is always selected from: The best level (Dark blue), Level 4 (Red), Level 3 (Yellow), Level 2 (Gray), or Level 1 (Light blue) 6.3.3.2 Best Level vs. Fixed Level In the previous section, we evaluated the approach of choosing the granularity of the data for each individual product code, considering one evaluation criterion at a time. Significant gainings were obtained in terms of the corresponding criterion, even if for the other criterion they were not satisfactory. The question can be raised if a simpler approach, such as using the best overall level for all products, could not achieve comparable results. Suppose that level four (aggregation with 2-digits product codes) is used for modeling all products. Figure 6.13 shows the average effort for all product codes in each month. It compares using a fixed level for modeling instead of using the best level for each product code. The figure shows that choosing the best level, the effort is always below 10% while by choosing any of the other levels systematically, the effort is always higher than 10%. In fact, because the best level is varied between different levels and it is not fixed, the average effort for the best level is lower than all individual levels. The results for recall are also illustrated in Figure 6.14. The only difference between recall and effort is that the recall for lower levels is higher due to more specific model for each individual product. But the effort for the higher levels, where there is more data for modeling, is lower (better) than other levels. Figure 6.14 shows that the average recall for the best level is almost higher than other levels which is the same result as effort. Accordingly, this strategy also cannot satisfy expert advice. 6.3 Results 85 6.3.3.3 Best Level Taking into Account the Expert Advice Although the optimal strategies focusing on effort/recall are quite good concerning the measure they optimize, the corresponding recall/effort are not acceptable by experts. For that reason, two additional strategies are attempted. They consist of determining the best value for a single measure, ensuring that the value for the other is within the limits established by the experts. For instance, the best effort for each product code is selected by considering only the results with a valid recall (more than 90%). The same course of action is performed for calculating the best recall. When computing the best recall, only the results with an effort less than 50% are considered. Finally, an average over the acquired results for each month are computed and shown in Table 6.7. Table 6.7: The average result for the best effort for acceptable recall and the best recall for acceptable effort by expert. Month Optimal effort Related recall Optimal recall Related effort w/ acceptable to the w/ acceptable to the recall optimal effort effort optimal recall 9801 11.38 100.00 97.82 10.92 9802 11.23 99.91 98.11 10.45 9803 15.05 100.00 96.61 10.52 9805 12.92 100.00 97.23 10.09 9806 15.45 100.00 96.17 10.82 9808 11.06 100.00 98.01 10.27 9809 11.81 100.00 97.74 9.81 9810 15.61 100.00 95.72 10.35 9901 20.66 100.00 93.22 10.52 9902 14.45 100.00 96.74 10.89 The results obtained with these new strategies are very good. When focusing on effort, the largest value is 20.66%, which is much less than the limit of 50%. In fact, most of the values are close to 10%. Furthermore, the corresponding recall is, except in one case, 100%. When compared to the previous effort-based strategy (Table 6.5), we observe that with a small increase in the effort (typically 4 p.p.), we obtain a rather large gain in recall (typical 15 p.p.). When focusing on recall, the results are also good, with an effort which is always around 10% yielding recalls that are almost always above 95%. When compared to the previous recall-based strategy (Table 6.5), the improvements are not as impressive. However, it should be noted that, in the new strategy, the results are all withing the limits defined by the experts, unlike in the previous one. Comparing this strategy with the selection of the best level taking into account a single criterion (Section 6.3.3.1), on average a significant gain for both effort and recall is obtained (comparing results in Tables 6.6 and 6.7). For example, in Table 6.6, the related effort to the optimal recall is 20.76% in the best case (in August) while in the same month and by taking into account the expert advice (Table 6.7), the effort is 10.27% (around 10% improvement/gain for effort). On the other hand, the best-related recall obtained in Section 6.3.3.1 is 86.85% for January 1998 while 86 Improving Model Performance by Using Existing Hierarchies in the Data Figure 6.15: The optimum effort Figure 6.16: The optimum recall for almost all months the recall is 100% when taking into account the expert advice. Therefore, around 14% gain is obtained with this strategy for recall. Figures 6.15 and 6.16 show that for both strategies, namely effort-based (Figure 6.15) and recall-based (Figure 6.16), the selected level of granularity is still distributed amongst all possible values. Thus, this figures confirm our hypothesis, that the optimum level to choose the data for making a local model is varied between all levels. 6.4 Summary In this chapter, we have investigated the effect of aggregating data at different levels of a product taxonomy in the performance of an outlier detection method applied to the problem of identifying erroneous foreign trade transactions collected by the Portuguese Institute of Statistics (INE). The approach is tested on 10 months of data and the results are evaluated in terms of the recall and the effort involved in the manual analysis of the selected transactions. The results show that, depending on the product, the best results can be obtained at different levels of aggregation. In fact, in some cases, the best results are obtained at the lowest level where there is no grouping. This means that different aggregation levels should be selected for different local models, i.e. products in this application. One approach that can be followed is to use a metalearning approach to mapping the characteristics of the data with the ideal level of aggregation Brazdil et al. (2009). This approach will be presented in Chapter 7and is tested on the same problem in Chapter 8. Although the results on the error detection problem are important to illustrate the generality of the proposed approach, our main goal is to test it on the generation of predictive local models for VANETs. This will be investigated in the Chapter 9. Chapter 7 A Metalearning Framework for Model and Data Granularity Selection Business Intelligence (BI) can help companies to implement an effective strategy or model reaching competitive market advantage and long-term stability. A BI application uses data from a Data Warehouse (DW) which is organized into dimensions. Taking into account the DW dimensions, model creation can be done in each dimension independently. Comparing the performance of these models reveal that the best performance can be obtained at different levels of hierarchy (Chapter 6). The data management problem addressed in this thesis is concerned with settings in which multiple local models are developed, i.e. models that are applicable to a small part of the space of data (local models), instead of a single global model. This is true in the VANETs, for instance, in the problem of predicting the duration of taxi trips addressed in this project, in which a model is developed for each car (Chapter 9). But local models can also be useful in more traditional Data Mining (DM) problems, in which the spatial issues involved in VANETs are not applicable. For instance, in the foreign trade error detection problem (Chapter 8), separate models can be developed to detect errors in transactions of different products. Figure 7.1 shows this model development in the data hierarchy. Different models are created at different levels and the performance of them is compared to select the best one. In these settings, the training data for a local model can be the local data, i.e. data from the part of the space that the model is associated with, or the learning process of a specific local model may use data from other parts of the data space. Despite potential gains in the quality of the models, the sharing of data may have costs. For instance, due to shared medium, transmitting data between vehicles has cost. Even in more traditional settings, such as in the foreign trade error detection problem, using more data for training the model increases the computational costs of that task. The results in the previous chapter confirm that there is potential in sharing data in the process of learning local models. However, the results also show that, depending on the part of the data space (i.e. the local model), the best results can be obtained at different levels of aggregation. Additionally, the results show that, in some cases, the best results are obtained at the lowest level 87 88 A Metalearning Framework for Model and Data Granularity Selection Figure 7.1: Illustration of a hierarchy in datasets: for each category the best performance (black model) is obtained at different levels where there is no grouping and the local model is trained using only local data. This means that different aggregation levels should be selected for different local models. One solution can be metalearning Vilalta and Drissi (2002). It models the relationship between the characteristics of the data with the performance of the algorithms. It is often used to select the best algorithm for a specific problem, such as classification or regression. Here, we use this approach to address the problem of selecting the right level of granularity, as defined by DW dimensions, to model a DM problem. In our approach, the characteristics of the data are mapped to the performance of the learning algorithms at different levels of granularity. The methodology which is used in this chapter is introduced in Section 7.1. 7.1 Methodology In this section, firstly the traditional method is presented (Section 7.1.1). Then the proposed framework is discussed by describing the definitions (Section 7.1.2), metafeatures (Section 7.1.2.1), and metadata (Section 7.1.2.2). 7.1.1 Traditional method In the real world, data is gathered by individual entities (Ei), where each entity is potentially associated with multiple examples (local data). For instance, an entity can be a product code or a taxi that has associated data. In the traditional approaches, a global model is developed by 7.1 Methodology 89 applying machine learning algorithms to the data from all entities to predict the future events for all entities. Suppose that the available dataset consists of nentities, {Ei,∀i∈ {1,...,n}}. Each example associated with the entity iconsists of a set of mfeatures, Xi= (x1,x2,...,xm), and a target variable, yi((Xi,yi)). Then, a global model that maps the features (Xi) to the target variable (yi) is learned from a training set (Figure 7.2). Finally, its performance is evaluated on the test dataset. Therefore the dataset used in the traditional data mining approaches is like DB ={Ei,Xi,yi},∀i∈ {1,...,n}. Figure 7.2: Traditional Data Mining approach As an example, in the previous chapter (Chapter 6), in the INTRASTAT dataset, each product code represents an entity and all data associated with this product code is considered as local data. The set of features in this case are: Ci= (Origin,In/Out,Lotnumber,Documentnumber,OperatorID,Month, Linenumber,Country,Productcode,Weight,Totalcost,Type, Cost/Weight,AverageWeight/Month,StandardDeviationo f Weight/Month,Score,Transactionnumber) (7.1) The target variable for this dataset is Error which makes this a classification task. According to the Tables 6.2 and 6.3, at the lowest level, there are nine observations on average for each category which indicates the number of observations for the local data. Equation 7.1 shows the complete list of features for each product code in the traditional approach. Another case study which is studied in this thesis is the taxi dataset taken from DRIVE-IN project Cmuportugal.org (2014). In this dataset and the lowest level, each taxi creates a category and all the observations for each taxi is the local data. Table 7.1 shows the number of taxis and 90 A Metalearning Framework for Model and Data Granularity Selection the average number of observations for each taxi in each month. There are around 440 taxis and at the lowest level, there are between 1238-1484 observations for local data. Table 7.1: A simple statistics about Taxi dataset Month No. of Taxis Average number of Month No. of Taxis observation per each taxi 201301 439.00 1328.20 201302 443.00 1238.50 201303 443.00 1356.60 201304 446.00 1302.70 201305 443.00 1484.90 201306 442.00 1385.70 201307 440.00 1416.90 201308 435.00 1253.90 201309 432.00 1382.10 201310 434.00 1478.50 In this dataset, the complete list of features is shown in Equation 7.2. The name of features is also provided in Table 7.2. The target variable is the trip duration. Therefore, the problem is a regression task. The objective is to predict the trip duration (dt). Ci= (X_id,driver,ts,st,id,pst,track, dd,src,dst,n,pos,dt)(7.2) 7.1 Methodology 91 Table 7.2: The description of Taxi dataset’s features Feature Feature’s description X_id Event identifier driver Taxi driver identifier ts Time stamp of the event (seconds) st Taxi state id Taxi identifier pst Previous state identifier track GPS track, encoded with polyline algorithm dd Distance between src and dst (meters) src GPS coordinates of the source position dst GPS coordinates of the destination position n Name of the taxi stand pos Location of the taxi stand dt Duration of the trip (seconds) The traditional scheme is unidirectional scheme (See Figure 7.2). It maps a set of features to a target variable. 7.1.2 Proposed Metalearning Framework In this section, we propose a generalized model that can be used in a broad range of applications. In the proposed model, there are kentities (Ei,∀i∈ {1,...,k}) which are organized into several hierarchies (Hp). For instance, entities are taxis which are organized according to their geographical positions (hierarchy). Each hierarchy is organized in different levels (Equation 7.3). For example, taxi level, road-side unit level, and a central unit level where the data from all taxis is collected. Hp={Lp,q},∀q∈ {1,...,lp}(7.3) where lpis the number of levels in the hierarchy p. However, since, we have a single hierarchy in our case study, we ignore hierarchies in the notation, for simplicity, thus, Lp,q≡Lq. In addition, each level in a hierarchy has a domain which is organized in categories, i.e., all taxis in the same geographical location or all taxi in the city. Another example are product codes which have 8-digits or 6-digits common product codes. This can be shown as: Lq={Cq,r},∀r∈ {1,...,kq}(7.4) where kqis the number of categories in the level qof the hierarchy p. Each category contains a set of entities (the ones that are associated with it). For instance, road side unit category contains all taxis within its communication range. In case of product codes, level two contains all the Chapter 8 Validation of the Metalearning framework: A Case Study on Error Detection in Foreign Trade Statistics In the previous chapter, we introduced a metalearning-based framework to address the problem of selecting the best level of data granularity to learn local models. This framework is useful for problems in which 1) learning processes are carried out at the local level (e.g. different vehicles in a VANET) and 2) there are costs in sharing data between learning processes (e.g. transmitting data between vehicles in a VANET), although 3) the quality of the models obtained by learning processes that combine different subsets of data may be better than the models obtained just with the local data. In Chapter 6, we showed that such a framework may also be useful in a more traditional data mining (DM) setting, in which similar issues are relevant. For instance, if the data is organized according to a data warehouse-like (DW) structure, with hierarchies of dimensions, then the local models can be obtained on the lowest level of the hierarchy (e.g. at the product level) but data sharing can be done based on that hierarchy (e.g. the model for a given product may use data from other products in the same category). In this chapter, we empirically test the framework on the problem addressed in Chapter 6, the detection of errors in foreign trade transactions. The chapter is organized as follows. Section 8.1 summarizes the case study description. Section 8.2 describes our customized methodology for data analysis and metalearning to find the best level of granularity for this case study. The obtained results are presented in Section 8.6. Finally, a conclusion is presented in Sections 8.7. 8.1 Case study: error detection in foreign trade statistics Foreign trade statistics are important to describe the state of the economy of countries Soares et al. (1999). They are usually estimated by the different national statistics institutes based on 99 100 Validation of the Metalearning framework: A Case Study on Error Detection in Foreign Trade Statistics data provided by companies. The problem in INTRASTAT dataset (See Tables 6.1 and 6.2 for the dataset description) is already describe at chapter 6, Section 6.1.1. The goal is to detect as many errors as possible – to maximize the quality of the statistics – with as little manual effort as possible – to minimize the cost. Some of the previous work on error detection has used outlier detection, classification and clustering approaches (e.g., Soares et al. (1999); Nozari Zarmehri and Soares (2014)). In general, satisfactory results have been obtained as some approaches were able to detect most of the erroneous transactions by choosing a small subset of suspicious transactions for manual inspection. However, this was not true for all products. This is partly due to the fact that some products have very few transactions. Given that each product is analyzed individually, the decision can be based on a very small set of data. In Chapter 6, the products are organized in a 4-levels taxonomy. An example of such a taxonomy can be Food (Level 4), Bread (Level 3), Sliced bread (Level 2), Pack of 16 slices (Level 1) (Figure 8.1). Figure 8.1: An example of existing taxonomy in foods Each product is presented with a unique 8-digits product code (Level 1). By going up in the product taxonomy, the number of products in each level increases. Therefore, by grouping the transactions at a higher level of the product taxonomy may help to obtain better results when compared to an analysis at the product level (Level 1) itself, especially in the cases where the number of observation at this level is too low. According to Chapter 6, the best results are obtained at different levels of the taxonomy for different products (Figure 7.1). For example, the best results for the products on the right leaf are obtained by training with the data from the third level of product taxonomy while for the products at the middle leaf, the best results are obtained by training with the data from the second level (black models in Figure 7.1). In spite of the fact that the results show that the aggregation is generally useful, they also show that the best results for different products are obtained at different levels of granularity (see Section 6.3.1). 8.2 Methodology 101 8.2 Methodology In Chapter 7, we introduce the framework used in this project. To obtain the best model for each entity, the training data can be used at different levels of hierarchy in the data taxonomy, including the local data, i.e. the data related to one product code, or the data from other levels, i.e. the data from level two where the data is aggregated by 6-digits product code(see Section 6.2). In this section, the proposed framework (see Chapter 7) is customized for the problem of error detection in foreign trade transactions. The entity here is a product code with 8-digits. For example instead of Ei,Piis used in the framework. Figure 8.2 shows the customized framework. The problem is to use the training data from the best level of granularity to apply an outlier detection algorithm. Therefore, the framework recommends a level with the best performance amongst all levels. In our experiment, there are different products, Pifor i=1,...,n1while n1is the number of unique products at the first level. The products are organized in a four-levels hierarchy (Cj i,j= 1,...,k)) where k=4. Each product is distinguished by an 8-digits code. Level one contains all the products with the same 8-digits code. Level two includes all the products with the same first 6-digits code. Similarly, levels three and four contain the products with the same 4- and 2-digits code, respectively. For example, all the dried fruits have a product code starting with 11 while raisins, which are a specific type of dried fruits, have code 1155. The best model for a given product depends on the product itself and the data available. For instance, given a very specific product with a lot of transactions, the best results can be obtained by learning a model on training data from that product only. On the other hand, if the product is very general behavior or has very few transactions, the best model can be obtained by training with the full dataset. It is expected that in other cases the best model can be obtained by training on data from intermediate levels of the hierarchy. Therefore, the question is, given a product, what subset of the data should be used for training. By mapping the characteristics of the different subsets to the performance of learning algorithms, a metalearning approach can be used in this problem. However, another question is raised. For large datasets, the number of candidate subsets is very large, so it is not feasible to consider all of them in a metalearning approach. When available, such as in our case study, a hierarchy of the observations (e.g. products, product families, . . . ) can be used to reduce the number of candidate sets of training data to be considered. Therefore, for product Pithe datasets considered contain the transactions concerning the levels C1 i,C2 i,...,Ck i (where k=4 in our case study). A metalearning approach is then used to choose, for a given product Pi, the level of the hierarchy, j=1,...,k=4, that contains the data which is expected to generate the best model for that product. For each unique product, metafeatures (see Section 8.2.1) are calculated at all levels, j= 1,...,k=4. m f j iis a vector containing the calculated metafeatures for the product iat the level j. The metadata consists of algorithm performance data and metafeatures. Algorithm performance data is obtained by running base-level experiments. In these experiments, an outlier detection method (LOF Torgo (2010); Nozari Zarmehri and Soares (2014)) is applied at each level, for each 102 Validation of the Metalearning framework: A Case Study on Error Detection in Foreign Trade Statistics product. The data from a month is used for training and the accuracy of the model is tested with the data from the next month. The performance of outlier detection for the product ion the level j is indicated by PI j i. Having PI j iand m f j ienables us to create the metadata set. Each metadata row includes the product code (Pi), metafeatures for all levels of the product code (m f j i,∀j∈ {1,...,k}), and the best performance obtained by outlier detection methods for that product among all the levels (PIbest i, see Equation 8.1). Equation 8.2 shows the format of the metadata sets in our experiment. PIbest i=max j(PI j i),∀j∈ {1,...,k}(8.1) {Pi,m f 1 i,m f 2 i,m f 3 i,m f 4 i,PIbest i}, ∀i∈ {1,...,n1}(8.2) By applying a learning algorithm on the metadata, we obtain a meta-model that can be used to predict the best level of granularity for each product code. 8.2.1 Metafeatures As discussed previously (Chapter 7, Section 7.1.2.1), a set of metafeatures is selected related to the problem. In this case study and according to our dataset, we select 15 metafeatures to describe the characteristics of INTRASTAT dataset. The extracted metafeatures are shown by m f j inotation in the customized framework. A list of all metafeatures which are used in this study with a brief description is provided in the Table 8.1 and is also described in Appendix A. 8.2 Methodology 103 Table 8.1: Extracted features used in metalearning - INTRASTAT dataset Feature Name Description n.examples Number of examples n.attrs Number of attributes prop.symbolic.attrs Proportion of symbolic attributes prop.missing.values Proportion of missing values class.entropy Class entropy avg.mutual.information Average mutual information prop.h.outlier Proportion of continuous attributes with outliers avg.attr.entropy Average attribute entropy avg.symb.pair.mutual.infor Average mutual information between pairs of symbolic attributes avg.abs.attr.correlation Average absolute correlation between continuous attributes avg.skewness Mean skewness of attributes avg.abs.skewness Mean absolute skewness of attributes avg.kurtosis Mean kurtosis of attributes canonical.correlation.best.linear.combination Canonical correlation of the best linear combination of attributes to distinguish between classes relative.prop.best.linear.combination Proportion of the total discrimination power explained by the best linear combination 104 Validation of the Metalearning framework: A Case Study on Error Detection in Foreign Trade Statistics Figure 8.2: Methodology used for metalearning 8.3 Experiments Setup 105 8.3 Experiments Setup In this section, the experimental setup at both base-level (Section 8.4) and meta-levels (Section 8.5) are explained. 8.4 Base-level In chapter 6we introduce our base-level experimental setup. There are ten months of INTRASTAT data. The LOF algorithm Torgo (2010); Nozari Zarmehri and Soares (2014) is trained on the data obtained from each level of granularity (see Section 8.2). In this case study, the number of algorithms at the base-level equals to one(g=1). Therefore, the output of the framework is the best level of granularity for each entity. As a result, for each product code, there are four performance indicators (PI j i) obtained from all possible levels (four levels, in this case, j=1,...,k=4). In the results section (Section 8.6), the levels are indicated by: level 1 (OD8), level 2 (OD6), level 3 (OD4), and level 4(OD2). While "OD" stands for the outlier detection method and the suffixes (8, 6, 4, and 2) show the number of common digits among the product codes used for aggregation. The evaluation part is done by testing each model obtained from above scenario against the data from the same level and the same product code in the next month. To be clearer, assume that for product code i, a model is trained using the data from month mat level two. Then this model is evaluated by the data taken from the level two for product ibut at the month m+1. Thereafter, by knowing the performance of outlier detection algorithm at all levels, the best level for each entity is selected as its actual value at the base-level. Then the majority level 1is selected as the prediction level for all entities at the base-level. Based on the actual and prediction values, the accuracy of the base-level is calculated. Two metrics are also used for the base-level evaluation: recall and effort. The explanations of the metrics are presented in Chapter 6, Section 6.2.3.1. 8.5 Meta-level Two machine learning algorithms were used in our experiments at the meta-level: Random Forest (RF) Amit and Geman (1997); Breiman;Liaw and Wiener (2002) and Decision Tree (DT) Olshen et al. (1984); Safavian and Landgrebe (1991); Ripley (2014). A DT is a tree-like structure, splitting a dataset into branch-like segments, by evaluating a condition on a feature in each node(F1, ..., F4 in Figure 8.3). The origin of the DT is a root node at the top of the tree (Figure 8.3). 1For example, if there are 10 entities in the dataset and the best level for these entities are levels 2, 3, 2, 1, 2, 4, 2, 1, 2, and 2 at the base-level, then the majority level is the second level (2). 106 Validation of the Metalearning framework: A Case Study on Error Detection in Foreign Trade Statistics Figure 8.3: Decision Tree structure: at each split one feature (F1 to F4) is evaluated The decision was taken after computing all features downward. The classification rules are the path from the root to the leaf. The choice of DT is related to the good results obtained on this problem previously by this algorithm Friedl and Brodley (1997). Random forest is an ensemble learning approach for classification, regression and other tasks Breiman. RFs are the multitude of decision trees (forest). The output is the mode von Hippel (2005) of the classes (classification) or mean von Hippel (2005) prediction (regression) of the individual trees. RFs are trying to overcome the problem of overfitting in DTs Hastie et al. (2009). In particular, trees overfit their training sets due to having low bias and high variance. Random forests are averaging multiple decision trees which are trained on different parts of the same training set with the goal of reducing the variance of DTs. Generally, this leads to great improvement in the performance of the final model Hastie et al. (2009). These algorithms are applied to the metadata (Equation 8.2) to train a model and predict the best level of granularity for each product code which is called predicted level. Following that, for evaluation, the accuracy of the meta-level is obtained by comparing the predicted level at the meta-level with the best level at the base-level. The accuracy is calculated using the Equation 8.3. The definition of all the elements of this equation is described in Table 6.4 and in the Section 6.2.3.1. This prediction accuracy is our primary evaluation measure for metalevel. Accuracy =t p +tn t p +f p +f n +tn (8.3) 8.6 Results As mentioned previously, the main performance evaluation metric is the accuracy of meta-level versus base-level. This metric shows that how well the meta-level can predict the best level for 8.6 Results 107 training at the base-level. In this section, the base-level results (Section 8.6.1) from previous Chapter 6is presented briefly. Then the meta-level results (Section 8.6.2) is compared with the base-level results. 8.6.1 Base-level Results The base-level results show that the best level for different product codes is varied. In this section the result of a selected example (product codes starting with 11) is presented in Section 8.6.1.1. Then the average results for different months (namely February and June) are shown in Section 8.6.1.2. Finally, the optimum results is illustrated in Section 8.6.1.3. 8.6.1.1 Selected Example The distribution of outlier scores for the month of February, concerning import transactions for product code 11681414 at different levels of hierarchy, is shown in Figure 6.4. The variation in the scores happens due to the accuracy of models in the different levels for different product codes. This score is used to distinguish the errors in the dataset. The transactions with high outlier score (namely more than the 1.5∗(Q3−Q1)J.S. Milton, J.J. Corbet (1997) (see Section 6.2.2) are selected as outliers (they contain an error). These results show that for this particular product code, at the higher levels where there are more transactions, the number of detected errors (with high outlier scores) is higher than the lower levels. Using these results, the obtained results for evaluation metrics (Section 6.2.3.1) are presented in the next section. 8.6.1.2 Monthly Results In this section, we present the previous results for two months, analyzed according to the different levels of the hierarchy in the product codes used for data aggregation. Looking at Figures 6.5 to 6.8, it is observed that the base-level can predict around 70% and less than 70% of the errors just by selecting 10% of the transactions. Despite a very significant reduction in the effort, the recall is not good enough to be accepted by the experts. On the other hand, for level three (4-digits), the model can predict more than 90% of the errors on February by analyzing just 12% of the transactions which is acceptable by the experts. So in this month, the best results are obtained by grouping the products at the four-digits level of the product codes (level three). In June (Figures 6.7 and 6.8), the results show that grouping by two (fourth level) and four (third level) digits of the product codes leads to just 10% of the effort. Although the x-axis shows the number of observations, the levels are also shown from level 1, the most left points, to the level 4, the most right points, in this figures. However, this is not an acceptable result due to very low recall (less than 90%). The best results for this month are obtained at the second level (six digits) of product codes. Chapter 9 Using Metalearning for Prediction of Taxi Trip Duration Using Different Granularity Levels In the previous chapter, we tested the metalearning-based framework (Chapter 7) to address the problem of selecting the best level of data granularity to learn local models (Chapter 8) on the problem of detecting errors in foreign trade transactions (Chapter 6). In this chapter, the framework is tested on another problem which is more related to this project. A taxi application introduces an interesting challenge for metalearning. Each taxi generates enough data to learn its own model. However, it can be expected that, in some cases, the quality of the global model generated from the full set of data, i.e. concerning all taxis, can be better than the model generated solely with "local" data. Therefore, besides selecting an algorithm to learn the best model for a taxi, a decision can be made also concerning whether only local data or global data. In this chapter, we close the circle on the data management goals of this project, by applying the same methodology to the problem of taxi trip time duration. More specifically, we investigate the use of a metalearning approach to the problem of algorithm selection in a case study of predicting trip duration for a taxi company. The taxi dataset is obtained from the Carnegie Mellon Portugal project, DRIVE-IN (Distributed Routing and Infotainment through Vehicular Inter- Networking) Cmuportugal.org (2014). The experiment is done on the data from five months in 2013, from February to June. In each month, the data is collected by around 440 taxis. The approach is evaluated at the meta-level (i.e. the ability to choose the most accurate baselevel algorithm) and at the base-level (i.e. the base-level performance of the algorithm selected by the metalearning approach). The results obtained are positive at both levels. The chapter is organized as follows. Section 9.1 summarizes the case study description. Section 9.2 describes our methodology for data analysis and metalearning to find the best level of 115 116 Using Metalearning for Prediction of Taxi Trip Duration Using Different Granularity Levels granularity. The evaluation strategies are discussed in Section 9.3. The obtained results are presented in Section 9.4. Finally, Section 9.5 concludes the chapter. 9.1 Motivation With the fast growth of Intelligent Transportation Systems (ITS) and Advanced Travelers Information Systems (ATIS), data collected by those systems can be useful to understand and improve processes in taxi companies and other organizations dealing with transportation, i.e. public transportation companies, logistics companies, and local government Rodrigues et al. (2011a). An example of a problem that can benefit from the analysis of data is trip duration in taxi companies Zhang and Rice (2003b); Rashed and Jürgens (2010); Lee and Gerla (2010a). Especially knowing the estimated trip time duration beforehand can be very informative for taxi companies, drivers, and passengers to make the right decision for the scheduling and route planning. Data concerning the taxi trips (essentially GPS data) collected by taxis can be used for that purpose. Data mining approaches can be used for the prediction of the trip duration. Using the data collected by taxis, these approaches relate trip duration with several variables describing the trip like origin, destination, time of day, day of week, and the weather. The prediction of trip duration may vary for different taxis, due to differences in the brand of the vehicle, its usage, and driving habits. Therefore, algorithm selection should be made not at the global level but at a lower one, such as the taxi itself. On the other hand, in applications with multiple sources of data in which the data schema is the same, it is possible that the quality of the model for a given source can be improved by training it with data from other sources. Therefore, the problem of algorithm selection is also extended to the dataset granularity selection. For the purpose of trip duration prediction, each taxi can use its data, data from its neighbors, data collected at the nearest road-side unit, or the whole dataset which is collected centrally throughout the city. 9.2 Methodology In this section, the methodology used in this chapter is described. The dataset is introduced briefly in Section 9.2.1. Section 9.2.2 explains the methodology which is applied on the base-level. The approach for meta-level is discussed in Section 9.2.3. The metafeatures used in the metalearning are also presented in Section 9.2.4. 9.2.1 Dataset The dataset is obtained from a large-scale scenario Cmuportugal.org (2014), one of the taxi companies in the city of Porto. Porto is the second largest city in Portugal, with an area of 41.3 km2, and comprises 965 km of roads. It is the central city in a metropolitan area with more than one million inhabitants. There are 63 taxi stands in the city and the main taxi union has 441 vehicles. 9.2 Methodology 117 Each taxi has an on-board unit with a GPS receiver and collects the travel log. The dataset provided by the project Cmuportugal.org (2014) consists of five months in 2013 for all the vehicles. The list of all features with their descriptions is already presented in Table 7.2. As an example of the scenario where the data is collected, Figure 9.1 shows a snapshot of the taxis’s placements in the city of Porto. The green dots show the taxi positions in the city. The communication range for two taxis (red and black) is also shown by purple circles. Figure 9.1: Illustrative map of Porto, Portugal. The green dots are the taxi placement. The neighboring area for red and black taxi is shown by purple circle around them. 9.2.2 Base-level Approach In this section, the traditional data mining method which is described in Section 7.1.1 is customized for the base-level experiment and this dataset. At the base-level, the same scheme is used. Each taxi is represented by an entity in the scheme, Ei=Ti. The target variable is the trip duration (Yi=DT i). So the base-level scheme is like DB ={Ti,Xi,DTi},∀i∈ {1,...,n}, where Ciis a set 118 Using Metalearning for Prediction of Taxi Trip Duration Using Different Granularity Levels of the features which are used at the base-level (Equation 7.2). And the objective is to predict the trip duration (dt). All the observations for each taxi is considered as the local data. There are 5 months data in 2013: February to June. Two levels of granularity are selected: taxi itself and the data for whole month, C1 i,C2 i(see Equation 7.2). Four algorithms are applied on different levels of the dataset (DB) at the base-level to predict the target variable (Trip Duration): •Decision Tree (DT) Olshen et al. (1984); Safavian and Landgrebe (1991); Ripley (2014), •Random Forests (RF) Amit and Geman (1997); Breiman;Liaw and Wiener (2002), •Support Vector Machines (SVM) Hearst et al. (1998); Schölkopf and Smola (1998); Steinwart and Christmann (2008), •Linear Regression (LM) Seber and Lee (2012); Montgomery et al. (2012). The results of this experiment is used for comparison at the base-level as well and to create the meta-dataset at the meta-level. 9.2.3 Meta-level Approach In terms of the metalearning approach, the possibility of generating meta-examples at different levels of granularity of the data, adds another dimension to the meta-dataset. So for each entity, instead of having just one set of Ci, other feature sets can be generated for different levels or categories of the data, C1 i,C2 i,C3 i,...,Ck i, where kis the number of levels or categories. Therefore the meta-dataset for the metalearning process is DB ={Ti,Cj i,Yi},∀i∈ {1,...,n},∀j∈ {1,...,k}. The customized model for this case study used in this chapter is shown in Figure 9.2. 9.2 Methodology 119 Figure 9.2: Proposed methodology used for metalearning In the proposed model, there are two different levels: the taxi itself (local model) and the data for the whole month (global model). At the level one, each taxi (Ti) creates a unique category, C1 i,∀i∈ {1,...,n1}where n1is the number of taxis. The level two data has only one category containing all the data from all taxis. At the meta-level, to create the meta-dataset, we need the best performance obtained at the base-level for each taxi. Therefore, the best base-level performance is selected as Pbestifor taxi i(see Equation 9.1). Pbesti=max w,j(Pj iw),∀w∈ {1,...,4},∀j∈ {1,2}(9.1) Where wis the number of algorithms and jis the number of levels at base-level. In addition, the metafeatures (see Section 9.2.4) are also calculated for each taxi and at different levels. In general m f j iis the calculated metafeatures for taxi iat the level j. As a result, there are two sets of metafeatures for each taxi: m f 1 iand m f 2 i. Finally the metadata (see Section 9.2.5) structure for each taxi consists of the taxi identification, metafeatures for the two levels and the best performance at the base-level obtained from Equation 9.1. A general form of metadata is shown in Equation 9.2. Ti,m f 1 i,m f 2 i,Pbesti(9.2) 120 Using Metalearning for Prediction of Taxi Trip Duration Using Different Granularity Levels In the experiment setup, two algorithms are applied on the metadata at the meta-level to predict the best performance ( ˆ Pbesti): •Decision Tree (DT), •Random Forests (RF). The target variable at the meta-level is Pbesti. The predicted best performance at the meta-level is called ˆ Pbesti. Using ˆ Pbesti, the meta-model recommends the best level and the best algorithm for each taxi to have the best performance at the base-level. The performance of metalearning model is evaluated using the predicted best performance (ˆ Pbesti) and the actual value obtained from Equation 9.1 (Pbest i). The results of this evaluation are presented in Section 9.4. 9.2.4 Metafeatures The extracted metafeatures noted above, are described briefly in this section. A comprehensive study was done by Peng et al. Peng et al. (2002) for feature selection. Also the reasons to select these metafeatures are also discussed in Section 8.2.1. For this problem, in total, 31 metafeatures were selected to describe the structure of the dataset. These metafeatures are selected based on the regression problem. Their effectiveness through extensive experiments was evaluated. A list of all metafeatures that we used for this study with a brief description is provided in Table 9.1. The detailed description of each metafeature is explained in Peng et al. (2002) and is also described in Appendix A. 9.2 Methodology 121 Table 9.1: The description of metafeatures used for metalearning Feature Feature’s description 1 Number of examples 2log(10)of the number of examples 3 Number of attributes 4 Ratio of number of examples by number of attributes 5log(10)of the ratio of number of examples by number of attributes 6 Number of continuous attributes 7 Number of symbolic attributes 8 Number of binary attributes 9 Proportion of continuous attributes 10 Proportion of symbolic attributes 11 Proportion of binary attributes 12 Correlation between continuous attributes 13 Average absolute correlation between continuous attributes 14 Minimum absolute correlation between continuous attributes 15 Maximum absolute correlation between continuous attributes 16 The ratio between the standard deviation and the standard deviation of alpha trimmed mean 17 Number of continuous attributes with outliers 18 Proportion of continuous attributes with outliers 19 Correlation matrix between attributes and target 20 Average correlation continuous attribute/target 21 Minimum correlation continuous attribute/target 22 Maximum correlation continuous attribute/target 23 Check if standard deviation is larger than mean 24 Ratio of the standard deviation and the mean of the target attribute 25 Sparsity based on the coefficient of variation 26 Sparsity based on the absolute coefficient of variation 27 Standard deviation of the proportions of a histogram with 100 bins of target values 28 textith.outlier value, as calculated for the continuous attributes 29 Outlier detection based on the notion of outliers used for continuous attributes 30 Mean distance between each target value and its two neighbors (sorted by value) 31 Average mean distance between each target value and its two neighbors (sorted by value) 122 Using Metalearning for Prediction of Taxi Trip Duration Using Different Granularity Levels 9.2.5 Metadata The dataset used for metalearning is called metadata. For each entity, the best performance obtained from the performance evaluation part is selected according to the Equation 9.1. The metadata for each entity is consisted of metafeatures for different levels plus the best performance obtained from the Equation 9.1. Equation 9.3 shows the general form of the metadata which is used for metalearning: Row i →Ti,m f 1 i,m f 2 i,...,m f k i,Pbesti(9.3) As an example, suppose we have only one metafeature which is the number of observations. Then the metadata is: the entity, the number of observations at level one (m f 1 i), the number of observations at level 2 (m f 2 i), and the best performance obtained amongst two levels (Pbesti). Equation 9.4 shows this example: Ti,m f 1 i,m f 2 i,Pbesti(9.4) The main idea of metalearning is to find out the best algorithm and the best level of hierarchy to apply the algorithm depending on the metafeatures obtained at different levels. Consequently, the metalearning maps the extracted metafeatures from the original datasets to the best performance obtained at different levels by applying different algorithms to the original dataset. Our metalearning model recommends a level and an algorithm for each taxi in which, applying the recommended algorithm on the recommended level produces the best performance (see Equation 9.5). Out put :{Ti |{z} entity ,j |{z} recommended level ,g |{z} recommended algorithm }(9.5) 9.3 Evaluation In this section, the evaluation process is discussed for both base-level 9.3.1 and meta-level 9.3.2. 9.3.1 Base-level evaluation At the base-level, the problem of prediction of the trip duration is a regression problem. Each algorithm is applied on the training dataset and the model obtained is applied to new examples to predict the corresponding trip duration. This prediction is evaluated by the Normalized Root- Mean-Square-Error (NRMSE). This measure is based on the popular RMSE (Equation 9.6), which is based on the differences between the predicted and the observed values. RMSE =s∑(ˆ Dti−Dti)2 n1 (9.6) where Dtiis the observed trip duration, ˆ Dtiis the predicted trip duration and n1is the number of predicted values. 9.4 Results 123 The NRMSE is the RMSE divided by the standard deviation of the variable being predicted (Equation 9.7). Using R R Core Team (2014b), the package hydroGOF Zambrano-Bigiarini (2014) is used to compute the NRMSE. NRMSE =100∗RMSE σ(9.7) where σis the standard deviation of the predicted variable. Having the NRMSE for all the possible runs, the algorithm with the best NRMSE (the lowest one) is selected as the best algorithm for each taxi to be used at the meta-level. 9.3.2 Meta-level evaluation As previously mentioned, at the meta-level, two algorithms were applied on the meta-data (Equation 9.2): random forest and decision tree. The meta-level approach predicts a base-level algorithms along the level of granularity which will have the best performance (lowest NRMSE) for a given taxi and month. The performance of the proposed metalearning model is evaluated by the accuracy of the prediction. This is done by comparing the predicted best performance ( ˆ Pbesti) and the actual value at the base-level (Pbesti). In addition, we also evaluate the performance of the proposed model relative to the possible range of base-level performance. Scalederror shows the relative NRMSE of the metalearning model with respect to the best and the worst NRMSE of the base-level. It is shown in the following equation: Scalederror =NRMSEML −NRMSEB NRMSEW−NRMSEB (9.8) where NRMSEML is the NRMSE of the proposed metalearning model, NRMSEBand NRMSEW are the best and the worst NRMSE obtained by the base-level algorithms, respectively. The metalearning approach can behave as well as the best performance at the base-level (NRMSEB) or as worse as the worst performance at the base-level (NRMSEW). Therefore, the range of Scalederror is between 0 and 1. If the prediction of the metalearning model equals to the best performance of the base-level, then Scalederror =0. In the worst case when the performance of the meta-model equals to the worst performance of the base-level, then Scalederror =1. As a result, the lower the Scalederror the better performance is expected for the meta-level experiment. 9.4 Results In this section, the use of metalearning for algorithm selection and level of granularity is investigated. The performance of different algorithms is evaluated for local and global data for each taxi at the base-level and the meta-level. Section 9.4.1 shows the base-level results while the performance of the meta-level is discussed in Section 9.4.2. The comparison of base-level and meta-level results is also illustrated in Section 9.4.3.