# Hot Spot Analysis over Big Trajectory Data - MASTER

←

→

**Page content transcription**

If your browser does not render page correctly, please read the page content below

Hot Spot Analysis over Big Trajectory Data Panagiotis Nikitopoulos1 , Aris Paraskevopoulos2 , Christos Doulkeridis3 , Nikos Pelekis4 and Yannis Theodoridis5 School of Information and Communication Technologies University of Piraeus, 18534 Piraeus, Greece {1 nikp,3 cdoulk,4 npelekis,5 ytheod}@unipi.gr, 2 arisparaskevop@gmail.com Abstract—Hot spot analysis is the problem of identifying domain, as this relates to various challenging use-case sce- statistically significant spatial clusters from an underlying data narios [10]. More specifically, having a predefined tessellation set. In this paper, we study the problem of hot spot analysis for of a region into areas of interest for which there is a priori massive trajectory data of moving objects, which has many real- life applications in different domains, especially in the analysis knowledge about occurring activities in them, it is very useful of vast repositories of historical traces of spatio-temporal data to be able to analyze – for instance – the intensity of the fishing (cars, vessels, aircrafts). In order to identify hot spots, we activity (i.e., fishing pressure) of the areas, or to quantify the propose an approach that relies on the Getis-Ord statistic, which environmental fingerprint by the passage of a particular type has been used successfully in the past for point data. Since of vessels from the areas. Similar cases exist in all mobility trajectory data is more than just a collection of individual points, we formulate the problem of trajectory hot spot analysis, domains. In the aviation domain, the predicted presence of using the Getis-Ord statistic. We propose a parallel and scalable a number of aircrafts above a certain threshold results in algorithm for this problem, called THS, which provides an exact regulations in air traffic, while in the urban domain such a solution and can operate on vast-sized data sets. Moreover, presence accompanied with low speed patterns implies traffic we introduce an approximate algorithm (aTHS) that avoids congestions. Thus, the effective discovery of such diverse exhaustive computation and trades-off accuracy for efficiency in a controlled manner. In essence, we provide a method that types of hot spots is of critical importance for our ability to quantifies the maximum induced error in the approximation, in comprehend the various domains of mobility. relation with the achieved computational savings. We develop Our approach for Hot Spot discovery and analysis is based our algorithms in Apache Spark and demonstrate the scalability on spatio-temporal partitioning of the 3D data space in cells. and efficiency of our approach using a large, historical, real-life Accordingly, we try to identify cells that constitute hot spots, trajectory data set of vessels sailing in the Eastern Mediterranean for a period of three years. i.e., not only do they have high density, but also that the density Index Terms—Hot spot analysis, trajectory data, parallel values are statistically significant. We employ the Getis-Ord processing, MapReduce, Apache Spark statistic [11], a popular metric for hot spot analysis, which produces z-scores and p-values by aggregating the density I. I NTRODUCTION values of neighboring cells. A cell is considered as a hot spot, Huge amounts of mobility data is being produced at un- if it is associated with high z-score and low p-value. precedented rates everyday, due to the proliferation of GPS Unfortunately, the Getis-Ord statistic is typically applicable technology, the widespread adoption of smartphones, social in the case of 2D spatial data, and even though it can be networking, as well as the ubiquitous nature of monitoring extended to the 3D case, it has been designed for point systems. This data wealth contributes to the ever-increasing data. In contrast, our application scenario concerns trajectories size of what is recently known as big spatial (or spatio- of moving objects, temporally sorted sequences of spatio- temporal) data [1], a specialized category of big data focusing temporal positions, and the applicability of hot spot analysis on mobile objects, where the spatial and temporal dimensions based on a metric, such as the Getis-Ord statistic (but also any have elevated importance. Such data include mobile objects’ other metric), is far from straightforward. trajectories, geotagged tweets by mobile Twitter users, check- To this end, we formulate the problem of Trajectory hot spot ins in Foursquare, etc. Analyzing spatio-temporal data has the analysis, where our main intuition is that the contribution of potential to discover hidden patterns or result in non-trivial a moving object to a cell’s density is proportional to the time insights, especially when its immense volume is considered. To spent by the moving object in the cell. In particular, we adapt this end, specialized parallel data processing frameworks [2]– the Getis-Ord statistic in order to capture this intuition for [5] and algorithms [6]–[9] have been recently developed the case of trajectory data. Then, we propose a parallel and aiming at spatial and spatio-temporal data management at scalable processing algorithm for computing hot spots in terms scale. of spatio-temporal cells produced by grid-based partitioning of In this context, a useful data analysis task is Hot spot the data space under study. Our algorithm achieves scalability analysis, which is the process of identifying statistically sig- by parallel processing of z-scores for the different cells, and nificant clusters (i.e. clusters which reject the null hypothesis). returns the exact result set. Moreover, we couple our exact Motivated by the need for big data analytics over trajectories algorithm with a simple approximate algorithm that only of vessels, we focus on discovering hot spots in the maritime considers neighboring cells at distance h (in number of cells),

Symbol Description instead of all cells, thus achieving significant performance D Spatio-temporal data set improvements. More importantly, we show how to quantify the p∈D Spatio-temporal data point (p.x, p.y, p.t) error in z-score computation, thereby developing a method that τ A trajectory (as a sequence) of points p1 , p2 , . . . can trade-off accuracy for performance in a controlled manner. P 3D space partitioning P = {c1 , . . . , cn } ci The i-th cell of partitioning P, (1 ≤ i ≤ n) In summary, our work makes the following contributions: xi Attribute value of cell ci ∈ P • We formulate the problem of Trajectory hot spot analysis, wi,j A weight indicating the influence of cell cj to ci by means of the popular Getis-Ord statistic, appropriately α Parameter used to define the weights wi,j tailored to become meaningful for sequences of spatio- n The number of cells in P G∗i The Getis-Ord statistic for cell ci temporal positions, rather than plain points. Ĝ∗i An approximate value of G∗i • We present a parallel algorithm that provides an exact Hij Distance between cells ci and cj (in number of cells) solution to the problem, and returns spatio-temporal cells top-k Requested number of most significant cells TABLE I with high scores that essentially constitute hot spots. OVERVIEW OF SYMBOLS . • To improve the efficiency, we also propose an approxi- mate parallel algorithm and a method that is able to trade- off result accuracy for computational cost, that bounds the error of the approximation in a controlled way. cells of P), where the significance of a cell ci is a function • We developed our algorithms in Apache Spark and we of the cell’s attribute value xi , but also of other neighboring demonstrate their efficiency and scalability by experimen- cells’ attribute values. A commonly used function (statistic) is tal evaluation on a large data set of vessel trajectories in the Getis-Ord statistic G∗i , defined as [11]: the Eastern Mediterranean Sea that span three years in Pn Pn total. ∗ j=1 wi,j xj − X j=1 wi,j Gi = q Pn 2 Pn (1) The remainder of this paper is structured as follows: Sec- [n j=1 wi,j −( j=1 wi,j )2 ] S n−1 tion II formulates the problem under study. Section III presents the proposed algorithm for hot spot analysis for big trajectory where xj is the attribute value for cell j, wi,j is the spatial data along with its implementation details. In Section IV, we weight between cell i and j, n is equal to the total number of present the approximate algorithm that solves the problem with cells, and: Pn much lower processing cost, and with controlled error in the j=1 xj X= (2) accuracy. Then, in Section V, we present the experimental n results using real-life data set, and in Section VI we provide an sP n 2 overview of research related to hot spot analysis and trajectory j=1 xj S= − (X)2 (3) data management. Finally, Section VII concludes the paper. n II. P ROBLEM F ORMULATION To model the intuition that the influence of a neighboring Consider a moving object database D that consists of cell ci to a given cell cj should be decreasing with increased trajectories τ ∈ D of moving objects. A trajectory, denoted by distance, we employ a weight function that decreases with an identifier τ , is a sequence of data points p described by 2D increasing distance. Namely, we define: wij = a1−ρ , where spatial coordinates (p.x and p.y), a timestamp (p.t), as well as a > 1 is an application-dependent parameter, and ρ represents any other information related to the spatio-temporal position the distance between cell i and cell j measured in number of of p. For example, attributes referring to weather information. cells1 . For immediate neighboring cells, where ρ = 1, we have We also use p.τ to refer to the trajectory that p belongs to. wij = 1, while for the next neighbors we have respectively: Furthermore, consider a spatio-temporal partitioning P which 1/a, 1/a2 , . . . ,. This definition captures an “exponential partitions the 3D spatio-temporal domain into n 3D cells decay” with distance in the contribution of neighboring cells {c1 , . . . , cn } ∈ P. Each data point p is mapped to one cell ci , to a given cell. which is determined based on p being enclosed in ci . Also, Based on this, the problem of trajectory hot spot analysis is we use cistart , ciend to refer to temporal start and end of a to identify the k most statistically significant cells according to cell ci . the Getis-Ord statistic, and can be formally stated as follows. We P also define the attribute value xi of the cell ci as: Problem 1: (Trajectory hot spot analysis) Given a trajectory xi = tend −tstart data set D and a space partitioning P, find the top-k cells τ ∈ci ciend −cistart , thus each trajectory τ that exists in a spatio-temporal cell ci contributes to the cell’s attribute T OP K = {c1 , . . . , ck } ∈ P based on the Getis-Ord statistic value by its temporal duration tend −tstart in ci normalized by G∗i , such that: G∗i ≥ G∗j , ∀ci ∈ T OP K, cj ∈ P − T OP K. dividing with the cell’s temporal lifespan ciend − cistart . This In this paper, we study an instance of Problem 1, where definition implies that the longer a moving object’s trajectory the aim is to perform hot spot analysis for trajectories over stays in a spatio-temporal cell, the higher its contribution to massive spatio-temporal data by proposing a parallel and the cell’s hot spot value. 1 Notice that this distance applies to the 3D grid, i.e., cells with the The problem of hot spot analysis addressed in this work is same spatial extent that belong to different temporal intervals have non-zero to identify statistically significant spatio-temporal areas (i.e., distance.

our solution using Apache Spark Core API, along with the Trajectory Data necessary technical details. Algorithm 1 THS Step 1: Build Attribute Grid Build Attribute Grid 1: Input: D, P 2: Output: gridRDD: RDD[i, xi ] Exchange Cell Information 3: function 4: gridRDD = D.mapToPair(p => Calculate Getis-Ord 5: emit new pair(getCellId(p) ⊕ p.τ , p.v) 6: ).reduceByKey(t1 , t2 => Trajectory 7: emit new pair(MIN(t1 , t2 ), MAX(t1 , t2 )) Hot-spots 8: ).mapToPair(cell trajectory id, (tstart , tend ) => −tstart 9: emit new pair(cell id, citend −cistart ) end Fig. 1. Overview of THS algorithm. 10: ).reduceByKey(v1 , v2 => emit v1 + v2 ) 11: end function scalable solution. Thus, we turn our attention to large-scale trajectory data sets that exceed the storage and processing B. Building the Attribute Grid capabilities of a single centralized node. We assume that the The first step of THS, depicted in Algorithm 1, takes as data set D is stored distributed in multiple nodes, without input a data set D of trajectories stored in HDFS and a spatio- any more specific assumptions about the exact partitioning temporal partitioning P, which defines the size of all cells mechanism. Put differently, a node stores a subset Di of the ci regarding their spatial and temporal dimensions. We use a function getCellId(p) to get the identifier i of cell ci enclosing T records of D, and it holds that D i Dj = ∅ (for i 6= j), data point p. Initially, the trajectory data points are mapped S and Di = D. Hence, in this paper, we study a distributed version of Problem 1. Table I provides an overview of the to key value pairs (line 5), where the key is composed by notation used in this paper. a string concatenation (denoted with ⊕ in the algorithm) of the data point’s cell id and its trajectory id (p.τ ), while the III. E XACT THS A LGORITHM value is the timestamp of p. This assignment of composite In this section, we present the THS (Trajectory Hot Spot) keys, enables us to group data points by cell id and trajectory algorithm for distributed hot spot analysis over big trajectory id; we calculate the minimum and maximum attribute values data. The proposed algorithm is designed to be efficiently (tstart , tend respectively) for each such group (line 7). Then, −tstart executed over a set of nodes in parallel and is implemented in we compute the fraction citend −c istart , individually for each end Apache Spark. The input data set D is assumed to be stored group defined by the composite keys, and keep only the cell in a distributed file system, in particular HDFS. id part of the key (line 9). We perform a regrouping based A. Overview on the new keys, to calculate the sum of the fractions for each cell (line 10). Hence, we have now successfully built the Intuitively, our solution consists of three main steps, which attribute gridP(gridRDD), by computing each cell’s attribute are depicted in Figure 1. In the first step, the goal is to compute −tstart value xi = t∈ci citend −c . all the cells’ attribute values of a user defined spatio-temporal end i start equi-width grid. To this end, the individual attribute values of Algorithm 2 THS Step 2: Exchange Cell Information trajectory data points are aggregated into cell attribute values, using the formula introduced in Section II. Then, during the 1: Input: gridRDD: RDD[i, xi ], P Pn second step, we calculate the cells’ attribute mean value and 2: Output: X, S, wSumRDD: RDD[i, j=1 wi,j xj ] standard deviation which will be provided to the Getis-Ord 3: function formula later. Furthermore, we 4: gridRDD.forEach(xi => update accumulators) Pncompute the weighted sum of 5: calculate X and S from accumulators the values for each cell ci : j=1 wi,j xj , by exchanging the cells’ attribute values between themselves. Upon successful 6: wSumRDD = gridRDD.flatMapToPair(i, xi => completion of the second step, we have calculated all the 7: wi = getWeightList(i) individual variables included in the Getis-Ord formula, and 8: for each j in wi do we are now ready to commence the final step. The goal of the 9: emit new pair(j, xi ∗ wi,j ) third step is to calculate the z-scores of the spatio-temporal 10: end for grid cells, by applying the Getis-Ord formula. The trajectory 11: ).reduceByKey(wx1 , wx2 => emit wx1 + wx2 ) hot-spots can then be trivially calculated, by either selecting 12: end function the top-k cells with the higher z-score values, or by selecting the cells having a p-value below a specified threshold. C. Exchanging Cell Information The above description explains the rationale of our ap- In its second step, as presented in Algorithm 2, THS takes proach. In the following, we describe the implementation of as input the attribute grid produced by the first step and the

spatio-temporal partitioning P. In line 4, we distributively calculate the sum and squared sum of the cells’ attribute values. Having computed these sums, we can trivially calculate the mean value X and standard deviation S, in a centralized Cells at 2 hops from cj fashion (line 5). Then, our goal is to broadcast each cell’s weighted attribute cj value to all the other cells of the grid. To this end, in lines 7- 10, we first get the list of weights between current cell ci and Cells at 1 hop all the cells cj of the grid (line 7). For each cell cj we emit from cj a new key value pair consisting of the j value as the key and the weighted attribute as its value (line 9). Then, we perform a grouping of these key value pairs, based on their keys (i.e. cell ids), while calculating the sum of their weighted attribute Fig. 2. Example of cells at distance from a reference cell cj (the dark color values (line 11). The result of this operation is the weighted indicates the weight of their contribution to cj ’s value xj ). sum grid (wSumRDD), which will be used for computing the Getis-Ord formula. in number of cells. Intuitively, cells that are located far away Algorithm 3 THS Step 3: Calculate Getis-Ord from ci will only have a small effect on the value G∗i , and Pn should not affect its accuracy significantly when neglected. 1: Input: X, S, wSumRDD: RDD[i, j=1 wi,j xj ], P More interestingly, we show how to quantify the error 2: Output: Gi RDD: RDD[i, G∗ ] i ∆G∗i = G∗i − Ĝ∗i of the computed hot spot z-score of any 3: function cell ci , when taking into account only neighboring cells at 4: Gi RDD = wSumRDD.mapToPair(i, wxi => distance h. In turn, this yields an analytical method that can 5: sumi = getWeightSum(i) be used to trade-off accuracy with computational efficiency, 6: squaredSumi = getWeightSquaredSum(i) wxi −X·sumi having bounding error values. 7: emit new pair(i, q [n·squaredSum −(sum )2 ] ) S i i n−1 A. The aTHS Algorithm 8: ) 9: end function Based on the problem definition, cells located far away from a reference cell ci , only have a limited contribution to the Getis-Ord value G∗i of ci . Our approximate algorithm (aTHS) D. Calculating z-scores with Getis-Ord statistic exploits this concept, and can be parameterized with a value h, which defines the subset of neighboring cells that contribute The third step of THS is depicted in Algorithm 3. It takes to the value of ci . We express h in terms of cells, for instance as input the X and S values computed in the previous part, setting h=2 corresponds to the case depicted in Figure 2, where along with the weighted sum grid and the spatio-temporal only the colored cells will be taken into account by aTHS for partitioning P. We map each cell’s weighted sum attribute the computation of Ĝ∗i (an approximation of the value of G∗i ). value to a z-score by applying the Getis-Ord formula. The sum In practice, the relationship between cell cj and white cells and squared sum of weights are initially computed (lines 5,6) can be expressed by setting their weight factor equal to zero. in order to be provided to the calculation of the Getis-Ord formula right after (line 7). Finally, the result of this operation, Algorithm 4 aTHS Part 2: Exchange Cell Information results to a data set (Gi RDD) consisting of cell ids and their 1: Input: gridRDD: RDD[i, xi ], P, h Pn Getis-Ord z-scores. 2: Output: X, S, wSumRDD: RDD[i, j=1 wi,j xj ] 3: function IV. A N A PPROXIMATE A LGORITHM : ATHS 4: gridRDD.forEach(xi => update accumulators) The afore-described algorithm (THS) is exact and computes 5: calculate X and S from accumulators the correct hot spots over widely distributed data. However, 6: wSumRDD = gridRDD.flatMapToPair(i, xi => its computational cost is relatively high and can be intolerable 7: wi = getWeightList(i) when the number of cells n in P is large. This is because 8: for each j in wi do every cell’s value must be sent to all other cells of the grid, 9: if DISTANCE(i, j) ≤ h then thus leading to data exchange through the network of O(n2 ) 10: emit new pair(j, xi ∗ wi,j ) as well as analogous computational cost, which is prohibitive 11: end if for large values of n. 12: end for Instead, in this section, we propose an approximate algo- 13: ).reduceByKey(wx1 , wx2 => emit wx1 + wx2 ) rithm, denoted aTHS, for solving the problem. The rationale 14: end function behind aTHS algorithm is to compute an approximation Ĝ∗i of the value G∗i of a cell ci , by taking into account only those In algorithmic terms, aTHS is differentiated from THS in cells at maximum distance h from ci . The distance is measured the second and third step. Algorithm 4 describes the pseudo-

code of the second step of aTHS. The main difference is in Further, let xmax denote the maximum value of xi for any line 9, where we check the distance between cells i and j; if cell ci in the grid. Then, we can replace xj with xmax and the distance is greater than the threshold h, then the emission we have: of a new key value pair does not occur (i.e. we do not broadcast the weighted attribute value of cell ci to cell cj ). xmax − X X ∆G∗i ≤ wi,j The third step of aTHS calculates the weight attribute sum γ Hij >h and squared sum, by applying a weight factor equal to zero, for cells cj which are located in a distance farther than h It is trivial to derive a formula that, for a given cell, returns from ci . This change affects only the implementation of the the number of cells at distance ρ. Function: f (ρ, d) returns getWeightSum and getWeightSquaredSum methods, used in the total number of cells (including the given cell) within ρ lines 5,6 of Algorithm 3. hops from the given cell: f (ρ, d) = (2ρ + 1)d , where d is the dimensionality. For example, for ρ=1 and d=3, f (1, 3) = 33 = B. Controlling the Error ∆G∗i 27, as expected. Then, the formula2 returning the number of In this section, we provide an upper bound for the value cells at exactly ρ hops away from a given cell is: f (ρ, d) − ∆G∗i . We use Hij to denote the distance measured in number f (ρ − 1, d). of cells between cells ci and cj . For example, in Figure 2, Also, recall that by definition wij = a1−ρ for cells ci and the darker colored cells are 1 hop away, while the lighter grey cj which are located at ρ hops away, then: colored cells are 2 hops away from the reference cell cj . Thus, X X we have: wi,j = a1−ρ [f (ρ, d) − f (ρ − 1, d)] Hij >h ρ>h ∆G∗i = G∗i − Ĝ∗i = Putting everything together: xmax − X X 1−ρ n n P P ∆G∗i ≤ a [f (ρ, d) − f (ρ − 1, d)] wi,j xj − X γ P P wi,j xj − X wi,j wi,j ρ>h j=1 j=1 Hij ≤h Hij ≤h s − s In summary, we can compute an upper bound for the error n n P 2 −( P [n P 2 −( wi,j P wi,j )2 ] [n wi,j wi,j )2 ] j=1 j=1 Hij ≤h Hij ≤h ∆G∗i introduced to the Getis-Ord value of a cell ci , due S n−1 S n−1 to approximate processing using only neighbors at distance 2 Since the expression n j=1 wi,j Pn −( j=1 wi,j )2 is positive Pn h. In turn, this allows us to explicitly set the value h in monotone with increasing n values, we can write the following Algorithm aTHS, in such a way that we can guarantee that the inequality by replacing the denominator of the first fraction maximum error introduced is quantified. In practice, an analyst with the second: can exploit our method to trade-off accuracy for computational efficiency, making aTHS an attractive algorithm for trajectory hot spot analysis over massive data sets. ∆G∗i ≤ V. E XPERIMENTAL E VALUATION n n In this section, we evaluate the performance of our approach for Trajectory hot spot analysis. We implemented all algo- P P P P wi,j xj − X wi,j − ( wi,j xj − X wi,j ) j=1 j=1 Hij ≤h Hij ≤h rithms in Java, using Apache Spark 2.2.0 Core API. Our Java s [n P 2 −( wi,j P wi,j )2 ] code can be found in: https://github.com/nikpanos/trajectory Hij ≤h Hij ≤h S hotspot analysis/tree/IEEE BigData18. n−1 A. Experimental Setup To simplify notation, let us s referPto the denominator of the P [n 2 −( wi,j wi,j )2 ] Platform. We deployed our code on a Hadoop YARN above expression as: γ = S Hij ≤h Hij ≤h , then 2.7 cluster consisting of 10 computing nodes. In all our n−1 experiments, we use the YARN cluster deploy mode. We the error ∆G∗i : initiate 9 spark executors, configured to use 5.5GB of main memory and 2 executor cores each. We also configured HDFS ∆G∗i ≤ with 128MB block size and a replication factor of 2. Data sets. We employed a real data set containing surveil- n n lance information from the maritime domain. The data was 1 X X X X collected over a period of three years, consisting of 83,735,633 [ wi,j xj −X wi,j −( wi,j xj −X wi,j )] = γ j=1 individual trajectories for vessels moving in the Eastern j=1 Hij ≤h Hij ≤h 2 We acknowledge that function f (ρ, d) provides an overestimation of the 1 X X ( wi,j xj − X wi,j ) number of cells, when the cell under study is situated at distance smaller than γ ρ from the grid boundaries, so we use this expression as an upper bound. Hij >h Hij >h

Mediterranean Sea. This data set is 89.4GB in total size which occur during the second step, and the fourth parameter and contains approximately 1.9 billion records. Each record (k) affects exclusively the last step of our algorithm. Also, we represents a point in the trajectory of a vessel and is made set a equal to 2 in all experiments. up by htrajectoryID; timestamp; latitude; longitudei. The For convenience, we briefly recall the steps of our algo- data set is stored in 720 HDFS blocks, in uncompressed text rithms here: format. • Step #1 (Building the Attribute Grid): The input data set Selecting hot-spots. In order to identify hot-spots on tra- of trajectories is transformed and aggregated to a set of jectory data, we opt to select them by reporting in the final cells (gridRDD), where each cell ci is expressed by its result set only the top-k grid cells having the highest Getis- id i and attribute value xi . Ord z-scores. To this end, after the execution of the third step • Step #2 (Exchanging Cell Information): First we compute of our solution, we perform a distributed sorting of all the the mean value X and standard deviation S of the cells in Gi RDD data set by descending order of their z-scores, attribute values xi . Then, each cell of gridRDD broad- and then, we pick the first k cells. Hence, our experimental casts its weighted attribute value to its neighbors and study includes a fourth step, which concerns the discovery of computes its weighted attribute sum. The resulting data top-k cells. The implementation of this fourth step is straight- set (wSumRDD) consists of cells ci which Pare n expressed forward, as the Spark Core API provides all the necessary by their id i and weighted attribute sum j=1 wi,j xj . methods for sorting an RDD, and then collecting the first k • Step #3 (Calculating z-scores): For each cell in wSum- values from it. RDD we calculate its Getis-Ord z-score. The resulting Metrics. Our main evaluation metric was the execution time RDD consists of cells ci which are expressed by their id needed for each individual step of our algorithm to complete i and z-score G∗i . in our experiments on the Spark cluster. In the following, the • Step #4 (Sorting and reporting top-k): The result is sorted actual execution times will be presented, omitting any over- by z-scores in descending order and we output only the head caused by Spark and YARN initialization procedures. All first k cells having the higher z-scores. execution times are depicted using the number of milliseconds Our experimental setup is summarized in Table II. In each elapsed for processing each step. experiment, we vary a single parameter, while setting the Furthermore, in each experiment, we measured (a) the total others to their default values. number n of cells in P, (b) the size |gridRDD| of non- empty cells in P and (c) the size |wSumRDD| of weighted B. Experimental Results attribute sum data, after executing the second step of aTHS Varying the spatial cell size. In Figure 3, we demonstrate (Algorithm 4). Essentially, these values greatly affect the the results of our experiments, by varying the spatial cell size performance of our solution, especially regarding the size of of P. Higher sized spatial cells decrease the total number of produced network traffic, thus providing a deeper insight to cells (n) used in the grid partitioning of the 3D space. In the complexity of our algorithm. Notice that by definition turn, this is expected to lead to reduced execution time, since |gridRDD| ≤ |wSumRDD| ≤ n, since |gridRDD| depends on fewer cells need to be computed and lower communication is the data distribution, and |wSumRDD| depends on the value required by the algorithm. Indeed, the overall execution time h. is reduced when the grid is of coarser granularity. Notice that we use log-scale on the y axis in all our charts, In terms of individual steps, the first step of our solution, throughout the experimental section. mostly depends on the size of input data set, thus it is not significantly affected by the spatial size of cells, as shown in Parameter Values Figure 3a. On the other hand, by using a larger cell size, the Spatial cell size of P (degrees) 0.05, 0.1, 0.5 performance of the remaining steps is improved, as the data Temporal cell size of P (hours) 1, 2, 12 is aggregated into smaller number of cells. Put differently, all h 1, 2, 3 top-k 50, 100, 500 constructed RDDs contain fewer objects and are of smaller TABLE II size, thus can be processed faster and produce less network E XPERIMENTAL SETUP PARAMETERS ( DEFAULT VALUES IN BOLD ). overhead by data exchange. Specifically, the execution time of steps two and four follows linearly the spatial size of cells, since for ten times larger cells, the execution time is ten times Evaluation methodology. We picked four parameters to less. Furthermore, step three proves to be the most efficient, study their effect on the efficiency of our algorithm, namely justified by the fact that it does not include any operation (a) the spatial size of cells (in terms of both latitude and involving the network. longitude), (b) the temporal size of cells, (c) the h distance Figure 3b depicts the total number of cells (n) in P, which defines the number of neighboring cells contributing to along with the number of cells contained in gridRDD and the score of a reference cell ci and (d) the k number of hot- wSumRDD, when using various sizes of cells for their spatial spots to be reported in the final result set. In practice, the first dimensions. As expected, the total number of cells decreases two parameters affect the number n of cells of P, the third for a more coarse spatial partitioning. Additionally, following parameter (h) refers to the number of broadcasting messages the input data distribution, the relative number of empty cells

Overall Step #3 n |wSumRDD| Step #1 Step #4 |gridRDD| Step #2 8 1x10 1x106 Number of records Time (milliseconds) 100000 1x107 10000 1x106 1000 100 100000 0.05 0.1 0.5 0.05 0.1 0.5 Spatial cell size (degrees) Spatial cell size (degrees) (a) Execution Time (b) Number of Cells Fig. 3. Performance of our algorithm for various spatial cell sizes of P. Overall Step #3 n |wSumRDD| Step #1 Step #4 |gridRDD| Step #2 6 1x108 Number of records 1x10 Time (milliseconds) 100000 1x107 10000 6 1x10 1000 100 100000 1 2 12 1 2 12 Temporal cell size (hours) Temporal cell size (hours) (a) Execution Time (b) Number of Cells Fig. 4. Performance of our algorithm for various temporal cell sizes of P. in the grid increases when using a finer partitioning scheme, Varying h. aTHS can be parameterized with a user-defined thus affecting the size of gridRDD data set. However, these variable h, which defines the set of neighboring cells contribut- empty cells may have a non-zero weighted sum attribute value, ing to the calculation of each cell’s z-score. Figure 5 demon- if they are located closely to other non-empty cells. This strates the experimental results when using different values for is demonstrated by the fact that wSumRDD is larger than variable h. The overall execution time is significantly reduced gridRDD, since the former includes also some empty cells for lower values of h, since each cell broadcasts its attribute which have a non-zero weighted sum attribute value. value to fewer neighboring cells, thus reducing the network Varying the temporal cell size. Figure 4 demonstrates the overhead for exchanging such information between cells. By efficiency of our algorithm for various temporal cell sizes. The using a value of 3 for variable h, we measured three times effect of larger cells in the temporal dimension to the overall higher overall execution time compared to the experiment execution time is similar to the previous experiment: larger having a value of 1. This significant reduction to the total temporal cell size leads to fewer total cells in the grid, thus execution time in aTHS, results to an approximate result Ĝ∗i . to reduced overall execution time. The experiment with the However, the deviation of Ĝ∗i to G∗i can be quantified as most coarse temporal partitioning (12 hours), was measured explained in Section IV-B. to be twice more efficient than the experiment using the finest The execution time of our algorithm’s first step, is not partitioning, in total execution time. affected by the value of h, since it is not dependent on this In terms of individual steps, the first step is (again) not variable. As such, the size of gridRDD data set is also not significantly affected by the size of the cell, since its associated affected by the value of h, as shown in Figure 5b. cost is dominated by the overhead of reading data from the By using a larger value of h, the size of wSumRDD disk. The execution time of the rest of the steps, appears to be increases, due to the fact that more empty cells obtain a higher for a finer temporal partitioning scheme, as depicted in weighted attribute sum which is greater than zero. This data Figure 4a. set is produced during the second step of our solution, while Similarly, the number of total cells in P decreases for a steps three and four operate on data sets having the same higher value of temporal cell size, as depicted in Figure 4b. size as wSumRDD. Hence, larger values of h result to higher The number of empty cells naturally increases for a finer execution times for these individual steps. defined grid, resulting to smaller gridRDD and wSumRDD data Varying top-k. The value of top-k affects the size of the sets. final result set. Figure 6 demonstrates the impact of this

Overall Step #3 n |wSumRDD| Step #1 Step #4 |gridRDD| Step #2 8 1x10 1x107 Number of records Time (milliseconds) 1x106 100000 1x107 10000 1000 100 1x106 1 2 3 1 2 3 h h (a) Execution Time (b) Number of Cells Fig. 5. Performance of our algorithm for various values of h. Overall Step #3 n |wSumRDD| Step #1 Step #4 |gridRDD| Step #2 1x108 1x106 Number of records Time (milliseconds) 100000 7 1x10 10000 1x106 1000 100 100000 50 100 500 50 100 500 k k (a) Execution Time (b) Number of Cells Fig. 6. Performance of our algorithm for various values of k. variable to data set sizes throughout the execution of our the clustering. A z-score near zero means no spatial cluster- algorithm and the individual steps’ processing times. The ing [11]. overall execution time, is not significantly affected by the Trajectory hot spot analysis is related to the problem of value of this variable. As shown in Figure 6a, the first three finding interesting places. In [14], interesting places are de- steps are not affected by the value of this variable, as their fined as either: (a) the areas where a single moving object goal is to compute the z-scores of all cells in P. This fact spends a large amount of time, or (b) the frequently visited is also reflected in Figure 6b, where the size of the data areas from various trajectories, or (c) the areas where many sets is the same for all values of k. The fourth step of our trajectories alter their state or behavior. In [15] interesting solution requires slightly higher processing time to produce places are identified as areas where several moving objects larger result set size, but the increase of its relative processing spend large amount of time, by moving with low speed. cost is negligible. The minimum amount of moving objects and their minimum stay duration, should be provided by the user at query time. VI. R ELATED W ORK However, to enable efficient execution for various parameters, Hotspot analysis is the process of identifying statistically an indexing structure is proposed which enables fast retrieval significant clusters. This kind of analysis is often confused of trajectory segments based on their speeds. Notice that these with clustering with respect to the density of the identified variations aim to discover spatial regions of interest, while groups [12]. The computation of density gives us information our approach identifies interesting spatial regions for various where clusters in our data exist, but not whether the clusters are temporal segments. statistically significant, that is the outcome of hotspot analysis. Hot spot analysis is a special case of spatio-temporal data In geospatial analysis the hotspot discovery is performed with analysis, mobility data mining and more specifically trajectory spatial statistics like Moran’s I [13] or Getis-ord Gi* [11] that data mining, since we are interested in trajectory-based hot measure spatial autocorrelation based on feature locations and spot analysis. These domains have been the subject of many attribute values, while they result in z-scores and p-values research efforts lately. Recent works on hot spot analysis for for the predetermined points or regions of interest. A high spatio-temporal data include [16], [17]. The study in [17] z-score and small p-value indicates a significant hotspot. A proposes a different way to visualize and analyze spatio- low negative z-score and small p-value indicates a significant temporal data. The aim is to identify areas of high event den- cold spot. The higher (or lower) the z-score, the more intense sity, by using multivariate kernel density estimation. Different

kernels in spatial and temporal domains can be used. After without constraints, [30] proposed a method to discover col- such hot spots have been identified, a spatio-temporal graph location patterns, while in [31] where the goal is to discover can be formed to represent topological relations between hot sequential trajectory patterns (T-patterns), the popular regions spots. In [16], a spatio-temporal graph is analyzed in order that participate in T-patterns can be computed automatically to find anomalies on people’s regular travel patterns. These following a clustering approach that utilizes the density of the interesting phenomena are called black holes and volcanos, trajectories in the space. The algorithm starts by tessellating represented as subgraphs with overall inflow traffic greater the space into small rectangular cells, for each of which the than the overall outflow by a threshold and vice-versa. The density (i.e., the number of trajectories that either cross it detection of frequent patterns and relations between black or found inside the cell) is computed. Then, by following holes and volcanos lead to the discovery of human mobility a region-growing technique the dense areas are enlarged by patterns. In [18], hot spot analysis is used for studying mobile including nearby cells as long as the density criterion is traffic. The aim is to identify locations where the density of fulfilled. The problem of identifying hot spots from trajectory data volumes transmitted is high, based on specific values of data in indoor spaces has been studied in [32]. It introduces thresholds. The results of the analysis are then used to detect a formula for computing scores for indoor locations based on the distribution of mobile data traffic hot spots and to propose users’ interests rather than measuring the amount of time a user a meaningful cell deployment strategy. spends in a specific area. This formula is used for calculating a In the domain of trajectory data mining [19] there are several score for each indoor area, based on the mutual reinforcement clustering approaches that are relevant to this work. The typical relationship between users and indoor locations. These meth- approach is to either transform trajectories to vector data, in ods have a different focus from our proposal sharing similar order for well-known clustering algorithms to be applicable, objectives and shortcomings as the aforementioned techniques. or to define appropriate trajectory similarity functions, which The problem of finding hot spots for spatio-temporal point is the basic building block of every clustering approach. For data has been studied in SigSpatial Cup at 2016 (http:// instance, CenTR-I-FCM [20] builds upon a Fuzzy C-Means sigspatial2016.sigspatial.org/giscup2016/home) where several variant to perform a kind of time-focused local clustering interesting methods where proposed. Among others, [33], [34] using a region growing technique under similarity and density proposed algorithms to identify hot spots based on spatial constraints. For each time period, the algorithm determines density of point data (in particular dropoff locations of taxis). an initial seed region (that corresponds to the sub-trajectory Instead, in this paper, we study the problem of hot spot restricted inside the period) and searches for the maximum analysis for trajectory data, which is different because the region that is composed of all sub-trajectories that are similar effect of a data point to a cell depends on the trajectory in with respect to a distance threshold d and dense with respect to which it belongs to (i.e., on other points). To the best of a density threshold . Subsequently, the growing process begins our knowledge, there is a lack of parallel processing solutions and the algorithm tries to find the next region to extend among that operate on distributed trajectory data in an efficient and the most similar sub-trajectories. The algorithm continues until scalable way to discover trajectory-based hotspots. no more growing can be applied, appending in each repetition the temporally local centroid. In the same line of research, VII. C ONCLUSIONS having defined an effective similarity metric, TOPTICS [21] In this paper, we formulate the problem of Trajectory adapts OPTICS [22] to enable whole-trajectory clustering (i.e. hot spot analysis, which finds many real-life applications clustering the entire trajectories), TRACLUS [23] exploits on in the case of big trajectory data. We propose two parallel DBSCAN [24] to support sub-trajectory clustering, while T- data processing algorithms that solve the problem, which Sampling [25], [26], introduces trajectory segmentation (aim- are scalable for data of large volumes. Our first algorithm ing at temporal-constrained sub-trajectory clustering [27]), by (THS) provides an exact solution to the problem, but may taking into account the neighborhood of a trajectory in the be computationally expensive depending on the underlying rest of the dataset, yielding a segmentation that is related grid partitioning and the number of cells. Also, we propose only on the number of neighboring segments that vote for an approximate algorithm (aTHS) that practically ignores the line segments of a trajectory as the most representatives. the contribution of cells located further away from the cell All the above trajectory clustering approaches they are capable under study, thereby saving computational cost. Perhaps more of identifying trajectory clusters and their densities but do not importantly, we propose a method that can be used to bound tackle the issue of statistical significance in the space-time the error in the approximation, for a given subset of cells they take place. that are taken into account. Thus, we can trade-off accuracy There are several other methods that try to identify frequent for efficiency in a controlled manner. Our implementation is (thus dense) trajectory patterns. In case where moving objects based on Apache Spark, and we demonstrate the scalability of move under the restrictions of a transportation network, [28] our approach using a data set of vessel trajectories that spans proposed an online approach to discover and maintain hot three years in total. In our future work, we intend to explore motions paths while [29] tackled the problem of discovering variants of the problem of trajectory hot spot analysis, which is the most popular route between two locations based on the a problem that deserves further study, also for data sets coming historical behavior of travelers. In case where objects move from other domains, such as the aviation or urban domain.

VIII. ACKNOWLEDGMENTS [17] J. Lukasczyk, R. Maciejewski, C. Garth, and H. Hagen, “Understanding hotspots: A topological visual analytics approach,” in Proceedings This research work has received funding from the Hellenic Founda- of the 23rd SIGSPATIAL International Conference on Advances tion for Research and Innovation (HFRI) and the General Secretariat in Geographic Information Systems, ser. GIS ’15. New York, for Research and Technology (GSRT), under the HFRI PhD Fellow- NY, USA: ACM, 2015, pp. 36:1–36:10. [Online]. Available: http: ship grant (GA. no. 1059), and from the European Union’s Horizon //doi.acm.org/10.1145/2820783.2820817 2020 research and innovation programme under grant agreements No [18] H. Klessig, V. Suryaprakash, O. Blume, A. J. Fehske, and G. Fettweis, 780754 (Track & Know), 687591 (datAcron) and under the Marie “A framework enabling spatial analysis of mobile traffic hot spots,” IEEE Sklodowska-Curie grant agreement No 777695. Wireless Commun. Letters, vol. 3, no. 5, pp. 537–540, 2014. [19] Y. Zheng, “Trajectory data mining: An overview,” ACM TIST, vol. 6, R EFERENCES no. 3, pp. 29:1–29:41, 2015. [20] N. Pelekis, I. Kopanakis, E. E. Kotsifakos, E. Frentzos, and Y. Theodor- [1] A. Eldawy and M. F. Mokbel, “The era of big spatial data: A survey,” idis, “Clustering uncertain trajectories,” Knowl. Inf. Syst., vol. 28, no. 1, Foundations and Trends in Databases, vol. 6, no. 3-4, pp. 163–273, pp. 117–147, 2011. 2016. [21] M. Nanni and D. Pedreschi, “Time-focused clustering of trajectories of [2] L. Alarabi and M. F. Mokbel, “A demonstration of st-hadoop: A moving objects,” J. Intell. Inf. Syst., vol. 27, no. 3, pp. 267–289, 2006. mapreduce framework for big spatio-temporal data,” PVLDB, vol. 10, [22] M. Ankerst, M. M. Breunig, H. Kriegel, and J. Sander, “OPTICS: no. 12, pp. 1961–1964, 2017. ordering points to identify the clustering structure,” in SIGMOD 1999, [3] L. Alarabi, M. F. Mokbel, and M. Musleh, “St-hadoop: A mapreduce Proceedings ACM SIGMOD International Conference on Management framework for spatio-temporal data,” in Advances in Spatial and Tempo- of Data, June 1-3, 1999, Philadelphia, Pennsylvania, USA., 1999, pp. ral Databases - 15th International Symposium, SSTD 2017, Arlington, 49–60. VA, USA, August 21-23, 2017, Proceedings, 2017, pp. 84–104. [23] J. Lee, J. Han, and K. Whang, “Trajectory clustering: a partition-and- [4] S. Hagedorn and T. Räth, “Efficient spatio-temporal event processing group framework,” in Proceedings of the ACM SIGMOD International with STARK,” in Proceedings of the 20th International Conference on Conference on Management of Data, Beijing, China, June 12-14, 2007, Extending Database Technology, EDBT 2017, Venice, Italy, March 21- 2007, pp. 593–604. 24, 2017., 2017, pp. 570–573. [24] M. Ester, H. Kriegel, J. Sander, and X. Xu, “A density-based algo- [5] M. Tang, Y. Yu, Q. M. Malluhi, M. Ouzzani, and W. G. Aref, “Lo- rithm for discovering clusters in large spatial databases with noise,” cationspark: A distributed in-memory data management system for big in Proceedings of the Second International Conference on Knowledge spatial data,” PVLDB, vol. 9, no. 13, pp. 1565–1568, 2016. Discovery and Data Mining (KDD-96), Portland, Oregon, USA, 1996, [6] C. Doulkeridis, A. Vlachou, D. Mpestas, and N. Mamoulis, “Parallel pp. 226–231. and distributed processing of spatial preference queries using keywords,” [25] N. Pelekis, I. Kopanakis, C. Panagiotakis, and Y. Theodoridis, “Un- in Proceedings of the 20th International Conference on Extending supervised trajectory sampling,” in Machine Learning and Knowledge Database Technology, EDBT 2017, Venice, Italy, March 21-24, 2017., Discovery in Databases, European Conference, ECML PKDD 2010, 2017, pp. 318–329. Barcelona, Spain, September 20-24, 2010, Proceedings, Part III, 2010, [7] R. T. Whitman, M. B. Park, B. G. Marsh, and E. G. Hoel, “Spatio- pp. 17–33. temporal join on apache spark,” in Proceedings of the 25th ACM [26] C. Panagiotakis, N. Pelekis, I. Kopanakis, E. Ramasso, and Y. Theodor- SIGSPATIAL International Conference on Advances in Geographic idis, “Segmentation and sampling of moving object trajectories based Information Systems, GIS 2017, Redondo Beach, CA, USA, November on representativeness,” IEEE Trans. Knowl. Data Eng., vol. 24, no. 7, 7-10, 2017, 2017, pp. 20:1–20:10. pp. 1328–1343, 2012. [8] Y. Xian, Y. Liu, and C. Xu, “Parallel gathering discovery over big [27] N. Pelekis, P. Tampakis, M. Vodas, C. Doulkeridis, and Y. Theodoridis, trajectory data,” in 2016 IEEE International Conference on Big Data, “On temporal-constrained sub-trajectory cluster analysis,” Data Min. BigData 2016, Washington DC, USA, December 5-8, 2016, 2016, pp. Knowl. Discov., vol. 31, no. 5, pp. 1294–1330, 2017. 783–792. [28] D. Sacharidis, K. Patroumpas, M. Terrovitis, V. Kantere, M. Potamias, [9] Y. Fang, R. Cheng, W. Tang, S. Maniu, and X. S. Yang, “Scalable K. Mouratidis, and T. K. Sellis, “On-line discovery of hot motion paths,” algorithms for nearest-neighbor joins on big trajectory data,” IEEE in EDBT 2008, 11th International Conference on Extending Database Trans. Knowl. Data Eng., vol. 28, no. 3, pp. 785–800, 2016. Technology, Nantes, France, March 25-29, 2008, Proceedings, 2008, pp. [10] C. Claramunt, C. Ray, E. Camossi, A. Jousselme, M. Hadzagic, G. L. 392–403. Andrienko, N. V. Andrienko, Y. Theodoridis, G. A. Vouros, and [29] Z. Chen, H. T. Shen, and X. Zhou, “Discovering popular routes from L. Salmon, “Maritime data integration and analysis: recent progress and trajectories,” in Proceedings of the 27th International Conference on research challenges,” in Proc. 20th Inter. Conf. on Extending Database Data Engineering, ICDE 2011, April 11-16, 2011, Hannover, Germany, Technology, EDBT, 2017, pp. 192–197. 2011, pp. 900–911. [11] J. K. Ord and A. Getis, “Local spatial autocorrelation statistics: Dis- [30] H. Cao, N. Mamoulis, and D. W. Cheung, “Discovery of collocation tributional issues and an application,” Geographical Analysis, vol. 27, episodes in spatiotemporal data,” in Proceedings of the 6th IEEE Inter- no. 4, pp. 286–306, October 1995. national Conference on Data Mining (ICDM 2006), 18-22 December [12] P. Zhao, K. Qin, Q. Zhou, C. Liu, and Y. Chen, “Detecting hotspots 2006, Hong Kong, China, 2006, pp. 823–827. from taxi trajectory data using spatial cluster analysis,” ISPRS Annals of [31] F. Giannotti, M. Nanni, F. Pinelli, and D. Pedreschi, “Trajectory pattern the Photogrammetry, Remote Sensing and Spatial Information Sciences, mining,” in Proceedings of the 13th ACM SIGKDD International Con- vol. 2, no. 4, pp. 131–135, 2015. ference on Knowledge Discovery and Data Mining, San Jose, California, [13] P. Moran, “Notes on continuous stochastic phenomena,” Biometrika, USA, August 12-15, 2007, 2007, pp. 330–339. vol. 37, no. 1, pp. 17–23, 1950. [32] P. Jin, J. Du, C. Huang, S. Wan, and L. Yue, “Detecting hotspots from [14] J. Gudmundsson, M. J. van Kreveld, and F. Staals, “Algorithms for trajectory data in indoor spaces,” in Database Systems for Advanced hotspot computation on trajectory data,” in 21st SIGSPATIAL Inter- Applications - 20th International Conference, DASFAA 2015, Hanoi, national Conference on Advances in Geographic Information Systems, Vietnam, April 20-23, 2015, Proceedings, Part I, 2015, pp. 209–225. SIGSPATIAL 2013, Orlando, FL, USA, November 5-8, 2013, 2013, pp. [33] G. Makrai, “Efficient method for large-scale spatio-temporal hotspot 134–143. analysis,” in Proceedings of SIGSPATIAL, 2016. [15] M. R. Uddin, C. Ravishankar, and V. J. Tsotras, “Finding regions of [34] P. Nikitopoulos, A.-I. Paraskevopoulos, C. Doulkeridis, N. Pelekis, and interest from trajectory data,” in Mobile Data Management (MDM), 2011 Y. Theodoridis, “BigCAB: Distributed hot spot analysis over big spatio- 12th IEEE International Conference on, vol. 1, 2011, pp. 39–48. temporal data using Apache Spark,” in Proceedings of SIGSPATIAL, [16] L. Hong, Y. Zheng, D. Yung, J. Shang, and L. Zou, “Detecting 2016. urban black holes based on human mobility data,” in Proceedings of the 23rd SIGSPATIAL International Conference on Advances in Geographic Information Systems, ser. GIS ’15. New York, NY, USA: ACM, 2015, pp. 35:1–35:10. [Online]. Available: http: //doi.acm.org/10.1145/2820783.2820811

You can also read