1 Introduction
Recent years have witnessed a tremendous growth in the collection of trajectory data and trajectory data analysis has become a prominent research stream with important applications in e.g. urban computing, intelligent transportation, animal ecology (Giannotti and Pedreschi, 2008; Zheng et al, 2014; Zheng, 2015; Parent et al, 2013; Güting et al, 2015). Spatial trajectories, in particular (simply trajectories hereinafter), are sequences of temporally correlated observations describing the movement of an object through a series of points sampling the timevarying location of the object (Zheng and Zhou, 2011). An example is shown in Figure 1.
For the sake of generality, we do not make any stringent assumption on location sampling frequency and regularity, even on the movement characteristics such as speed, heading and so forth. The only loose assumption is that the temporal distance between two consecutive points is relatively small (with respect to the mobility phenomenon under consideration). In this view, the trajectory is simply a sequence of relatively close in time ordered points.
A major analysis task over trajectories is trajectory segmentation. Generally speaking, the segmentation task splits a sequence of data points, in a series of disjoint subsequences consisting of points that are homogeneous with respect to some criteria (Keogh et al, 2001; Aronov et al, 2015). Diverse segmentation criteria have been proposed in literature, even for different purposes, including time series summarization, e.g. (Keogh et al, 2001; Esling and Agon, 2012), and trajectory indexing in databases, e.g. (Rasetic et al, 2005; CudréMauroux et al, 2010). In this paper we focus on a slightly different problem, that is splitting a trajectory in apriori unknown number of segments based on spatial density and temporal criteria. We refer to this problem as clusterbased segmentation. The clusterbased segmentation problem can be introduced as follows. Consider a trajectory of temporally ordered points in a generic metric space. e.g. the Euclidean space, with a time instant and a point of space, and consider a segmentation for consisting of a set of temporally ordered subsequences, denoted , covering the trajectory, i.e., . We say that such segmentation is clusterbased if the following conditions hold:

A subset of segments are clusters representing spatially dense sets of points. Such clusters are thus temporally separated.

The points temporally lying between two consecutive clusters (or one cluster and the begin/end of the trajectory) are points that cannot be added to any cluster. Such points form a segment called transition.
The sequence of alternating clusters and transitions represents the trajectory segmentation induced by the clustering technique.
Applications and requirements. A major application of clusterbased segmentation is to detect stopandmove patterns (Parent et al, 2013). Stopandmove is an individual pattern (Dodge et al, 2008)
typically describing the behavior of an object
that resides in a region of space for some time, i.e. a stop or residence,
and then moves to some other region, in a continuous flow from stop to stop. This behavior can be exhibited at different temporal scales. For example, Figure 2.(a) illustrates the trajectory of an animal that during the seasonal migration moves from one homerange to another homerange (Damiani et al, 2014). At a different time scale, Figure 2.(b) shows
the wandering of the eye gaze stopping in fixations
during the observation of a scene (Cerf et al, 2008).
Intuitively, the stopandmove pattern is exhibited by those phenomena that alternate periods of relative stability to periods of instability.
An interesting question, related to the concept of clusterbased segmentation,
concerns the meaning of noise in such a setting.
Broadly speaking, noise consists of data points that do not fit into the clustering structure and that for such a reason can be considered as diverging
(Ester et al, 1996; Han et al, 2011).
In our case  if we rule out possible errors during the data collection phase  we can see that there are two classes of unclustered points: the points representing a transition and the points
that do not belong to either a cluster or a transition. In the latter case, the noise indicates, in essence, a temporary departure or absence from the cluster.
For example, this notion of temporary absence can be exemplified by an individual leaving the area where he/she resides, for example for a travel, and then returning back after a period of time. Note that such an absence cannot be qualified as a transition because the individual in reality does not change residence but simply leaves it for a period.
Put in different terms, absence points represent a form of noise that is somehow local to clusters in contrast to transition, which represents an intercluster noise. To emphasize this characteristic, we will refer to this form of noise as local noise. Figure 3 highlights the key difference between cluster, transition and local noise.
Local noise can have an applicationdependent meaning.
For example, in the field of animal ecology, biologists use the term ’excursion’ to characterize the temporary absence from the homerange where the animals reside (Damiani et al, 2016).
In summary, the local noise represents a semantically meaningful ingredient of many dynamic phenomena and as such cannot be neglected.
Approach. Conventional clustering and segmentation techniques, if taken alone, present intrinsic limitations that make them unsuitable for the clusterbased segmentation problem. For example, timeaware clustering methods such as STDBSCAN (Birant and Kut, 2007) and DensStream (Cao et al, 2006) for the clustering of spatiotemporal events and stream data respectively, do not guarantee the temporal ordering of clusters. In particular, STDBSCAN groups points that are close both in time and space, while DensStream assigns data points a weight based on their temporal freshness to determine whether a group of points is actually a cluster. In both cases, however, the clusters may be not temporally ordered. By contrast, trajectory segmentation techniques, e.g. (Aronov et al, 2015; Kang et al, 2004; Buchin et al, 2013), while generating temporally ordered segments, fall short in handling noise. On the other hand, simple solutions, such as introducing a tolerance on the number of noise points inside a segment, as in (Kang et al, 2004; Buchin et al, 2013), are problematic and do not provide guarantees.
In this research, we investigate a robust solution to the problem of clusterbased segmentation of trajectories with local noise. It is worth noting that in case of no local noise  the individual simply moves from one residence to another residence  the clusterbased segmentation is fairly straightforward. It is sufficient to aggregate the points of the sequence in clusters using a DBSCANlike technique (Ester et al, 1996)
. Next, once a cluster is created, the first point in the sequence that cannot be added to such a cluster determines the break of the segment. The problem with this solution is that whenever the unclustered points do not have an univocal interpretation, i.e., can represent both a temporary absence and the definitive departure from the current cluster, such points cannot be correctly classified until the actual destination or, put in other form, the object’s behavior is not known. A different approach is thus needed. The research presented in this article significantly extends the earlier proposal presented in
(Damiani et al, 2014). Such proposal comprises the SeqScan clusterbased segmentation model, centered on the notion of presence/absence in/from the cluster, and the segmentation algorithm. Two key questions remain, however, open: how to provide guarantees about the types of patterns that can be discovered; and how to prove the effectiveness of the solution. In this article we address both questions through an indepth analysis of the properties of the segmentation model and the study of suitable evaluation methods. Moreover, to highlight the application potential of the technique, we investigate how the framework can be used to facilitate the discovery of additional mobility patterns, which we call derived, such as recursive movement patterns (Li. and Han, 2014). Specifically, we propose a technique for location periodicity detection. To our knowledge this is the first comprehensive framework offering a robust solution to the clusterbased trajectory segmentation problem with noise. In summary, the main contributions are as follows.Contributions.

We provide a rigorous specification of the SeqScan framework, which consolidates the earlier version (Damiani et al, 2014). In particular, we introduce and analyze the property of spatial separation of clusters. While such a property is given for grant in classical clustering, it requires a specific characterization in the mobile context where the movement can be recursive, i.e. the same region can be repeatedly visited at different times. As a result, we identify three different mobility patterns, depending on whether clusters are strongly separated, weakly separated or overlapping. Moreover, we show that the segmentation algorithm splits the trajectory in pairwise separated or weakly separated clusters. In essence, weakly separated clusters describe the circular movement between two consecutive clusters.

We study analytically the relationship between the number of clusters and the temporal parameter  the presence  in order to facilitate the choice of the presence threshold during the segmentation task.

We evaluate the effectiveness of the segmentation technique by contrasting the SeqScan segmentation with ground truth. The ground truth consists of a set of labeled trajectories simulating the movement of animals. The trajectory generator is developed by the ecologists coauthoring this article. The evaluation is then conducted through blind experiments.

Finally, we propose a novel technique for the discovery of periodically visited locations, which leverages SeqScan and the novel concept of cluster spatial similarity. We contrast our solution with stateoftheart methods, using real data. The approach is shown to be effective, simpler to use, and more informative than stateoftheart methods even in case of periodicity with noise.
The remainder of the article proceeds as follows: Section 2 overviews related research; Section 3 presents the clusteringbased segmentation model and shows the key properties of the model that are at the basis of the SeqScan algorithm presented in Section 4 along with the temporal parameter analysis. Section 5 presents the novel technique for the discovering of periodically visited locations (the derived pattern). The experimental evaluation of both SeqScan and the derived pattern discovery technique is presented in Section 6. We conclude with a discussion in Section 7 and final remarks in Section 8.
2 Related work
We focus on two
major streams of related research
concerning the segmentation of trajectories and the detection of stopandmove patterns, respectively.
Trajectory segmentation.
Closely related to our work is the area of computational movement analysis,
a relatively recent stream of research, rooted in computational geometry and geographical information science, and primarily focused on the concept of movement pattern, e.g. (Gudmundsson et al, 2008; Dodge et al, 2008; Buchin et al, 2011, 2013; Alewijnse et al, 2014; Aronov et al, 2015).
Movement patterns describe stereotypical mobility behaviors of individuals located in a geographical space, typically characterized in terms of movement attributes or characteristics, such as speed, velocity, direction change rate (Gudmundsson et al, 2008; Dodge et al, 2008). The segmentation problem is defined as follows: to split a highsampling rate trajectory into a minimum number of segments such that the movement characteristic
inside each segment is uniform in some sense (Buchin et al, 2011).
Buchin et al (2011, 2013) address the problem of splitting a trajectory based on segmentation criteria that are monotone (decreasing), namely the conditions on the movement characteristics are satisfied by all of the points of the segment. An example is a range condition over speed.
This approach, however, suffers from a major limitation, in that the criteria of practical interest are often nonmonotone. For example the property regarding the density in space of the points in a segment is nonmonotone.
A more flexible framework is presented in Alewijnse et al (2014), which introduces the notion of stable criteria, that is criteria that do not change their validity ’very often’. Such framework can handle Boolean combinations of increasing and decreasing criteria, where increasing means that whenever the condition is satisfied by a certain segment it is satisfied also by the segments that contain that segment. An example combining increasing and decreasing criteria is staying in an area for a minimum duration. Moreover, segmentation tolerates a certain amount of noise, in that a condition can be satisfied except for a fraction of points. Our model differs from this solution in several aspects: the problem is not formulated as an optimization problem, moreover we do not seek to provide a generalized segmentation framework. Rather we focus on a specific nonmonotone property, density, which cannot be straightforwardly expressed using the aforementioned criteria. Moreover, we handle noise through the notion of presence/absence, and not counting the points. This solution not only makes the technique more usable (i.e., the presence parameter may have an application meaning), but also makes it much more robust and flexible in case of trajectories with missing points or varying sampling rate. A different and challenging direction is explored in (Aronov et al, 2015)
. The problem of computing the minimal set of segments based on nonmonotonic criteria is shown to be NPhard in a continuous setting, i.e., where trajectories are interpolated linearly between data points and segments can start and end between data points. Though, two specific criteria are shown to satisfy properties that make the segmentation problem tractable. Interestingly, both these criteria are related to noise. In particular, one criterion requires that the minimum and maximum values of the given attribute on each segment differ at most for a given amount, while allowing a certain percentage of outliers. The second criterion requires the standard deviation of the attribute value in the segment not to exceed a threshold value. For the same reasons discussed above, our goal is substantially different, moreover our solution can be utilized in both discrete and continuous settings.
Segmentation methods are also investigated in other scientific domains, especially in animal ecology, for the detection of activities or behavioral states, e.g., foraging, exploration or resting (Edelhoff et al, 2016). Such methods rely on: movement characteristics analysis (in the sense discussed above), timeseries analysis, e.g., (Gurarie et al, 2009)
and statespace models, such as hidden Markov models, e.g.,
(Michelot et al, 2017). There is, however, a substantial difference between these methods and our proposal. Firstly, our solution does not target activity recognition. Rather, the goal is movement summarization in presence of noise. Secondly, our technique applies to sequences of temporally annotated data points defined in a metric space, thus the solution is not confined to the analysis of the physical movement in an Euclidean space. In this sense, the solution gains in generality and can be employed in arbitrary spaces.Stopandmove detection. A number of techniques for the detection of stops and places have become quite popular in recent times (Damiani and Hachem, 2017). A pioneering technique is the CBSMoT algorithm (Palma et al, 2008). Similarly to DBSCAN, CBSMoT relies on the notion of neighborhood. The neighborhood of a point is however defined along the piecewise linear representation of the spatial trajectory. It is thus a subtrajectory consisting of all the points whose distance from along the line is at most . Moreover, the parameter specifying the number of points located in the neighborhood, is replaced by the parameter MinTime specifying the minimal duration of the neighborhood. The substantial limitation of this approach is that it resembles DBSCAN without in reality preserving the actual spirit; in particular, this technique is sensitive to noise, because the first point in the sequence that does not belong to the current cluster determines a breakpoint in the sequence. Indeed, noise sensitivity is a common issue to all of these techniques, despite the attempts to overcome the problem. For example, the algorithm presented in (Kang et al, 2004) tolerates up to a maximum number of noise points between two consecutive points in the same cluster. As the noise points exceed this bound, a breakpoint is added. Clearly if the number of noise points is variable or the sampling rate is not regular, this expedient falls short. Another technique is proposed by Zheng et al. (Zheng et al, 2011) as part of a location recommendation system. This solution is even more restrictive: the first point that is sufficiently far from the beginning of the segment determines a breakpoint. Hence if the duration of such a segment is too brief with respect to the given threshold value, all the points of the segment become noise. A common feature of all of these techniques is that they do not offer theoretical guarantees, are defined for narrow domains, and lack systematic validation on field. On a different front, the MoveMine project (Li et al, 2011) presents a technique for the extraction of the periodic movement of an object moving across reference spots, where the reference spot is basically defined as a dense region (Li et al, 2011). For the detection of reference spots a popular kernel method (Worton, 1989) designed for the purpose of finding home ranges of animals is used. The notion of reference spot is, however, static and does not consider time, thus reference spots do not have a temporal granularity, which instead is one of the qualifying features of our model. We will come back to the MoveMine approach, later on in the paper.
3 The clusterbased segmentation model
This section introduces the clusterbased segmentation model. We review the basic concepts and discuss the key properties that are at the basis of the algorithm presented in the next section. Preliminarily, we briefly review the DBSCAN cluster model (Ester et al, 1996), which provides the ground for the proposed framework and introduce the basic terminology.
3.1 Preliminaries and notation
Consider a database of points in a metric space. Let be the distance function, e.g. the Euclidean distance, and (i.e. the distance threshold), and (i.e. the minimum number of points in a cluster) the input parameters. The cluster model is built on the following definitions (Ester et al, 1996):
Definition 1 (DBSCAN model)

The neighborhood of , denoted , is the subset of points that are within distance from , i.e. .

A point is core point if its neighborhood contains at least points, i.e. . A point that is not a core point but belongs to the neighborhood of a core point is a border point.

A point is directly densityreachable from if is a core point and .

Two points and are density reachable if there is a chain of points , such that is directly reachable from .

Points and are density connected if there exists a core point such that both and are densityreachable by .

A cluster C wrt. and is a nonempty subset of points satisfying the following conditions:

1) : if C and is densityreachable from , then C (Maximality)

2) is densityconnected to (Connectivity)


A point is a noise if it is neither a core point nor a border point. This implies that noise does not belong to any cluster.
An example illustrating the DBSCAN concepts is shown in Figure 4. Apart from a few peculiar situations^{2}^{2}2The property is not satisfied by border points. Yet, that is marginal for our work, the result of DBSCAN is independent of the order in which the points of the database are visited (Ester et al, 1996). Therefore, the algorithm cannot detect sequences of clusters based on some ordering relation over points.
Consider now a trajectory of points . For the sake of simplicity, the trajectory is represented by the interval of indices , with indicating the iesim point . Besides the spatial distance , consider the function computing the temporal distance between points and , respectively. A subtrajectory of is represented by a connected interval ; a segment by a possibly disconnected interval  a union set of disjoint connected intervals. Intuitively, a segment is a subtrajectory that can have ’holes’. As shown in Figure 5, a trajectory is visually represented as sequence of numbered circles indicating the indexed points on the plane. The basic notation used throughout the paper is summarized in Table 1.
I=[i,j]  Sequence of indexed points 

Segment  
Spatial point, temporal annotation  
Spatial distance  
Temporal distance  
K,  DBSCAN parameters 
Neighbourhood of point of radius  
Presence threshold  
Cluster/stay region  
The value of presence in S  
Duration of S  
Noise local to S  
Sequence of stay regions  
Transition  
Spatial separation predicate  
Minimal Stay Region in S  
3.2 Cluster and stay region model
Basically, a stay region is a DBSCAN cluster satisfying a temporal constraint. The key concepts are:
Definition 2 (Cluster)
Given a trajectory , a cluster is a segment consisting of points that, projected on the reference space, constitutes a DBSCAN cluster (w.r.t. density parameters ). Moreover, if the segment is bounded by points and then the DBSCAN cluster includes the projection of and . The set difference specifies the corresponding local noise, denoted .
Example 1
Consider the trajectory T=[1,7] in Figure 6.(a) (we omit the coordinate axes for brevity). If we run DBSCAN on the set of spatial points with parameters K=4 and sufficiently small, we obtain that the set forms a DBSCAN cluster. Thus the segment is a cluster in our model, while the points 5 and 6 are local noise.
A cluster has a duration , and a presence . The duration is simply the temporal distance between the first and last point of the segment, namely . The presence estimates the residence time in the cluster, with exclusion of the absence periods, i.e. local noise. Specifically, the presence of is defined as the cumulative duration of the connected intervals in .
Definition 3 (Presence)
Given a cluster , with a connected interval, is defined as follows:
(1) 
The presence in a cluster ranges in the interval [0, ].
Example 2
This definition of presence relies on the following assumption, that if two consecutive points are both members of the cluster then the whole time between and is assumed to be spent ’inside’ the cluster, or more precisely inside the spatial region where the object resides. Conversely, if at least one of the points does not belong to the cluster, then the whole time between and is spent outside the cluster. If the points are relatively close in time  as we assume  we postulate that the presence value can provide a good estimation of the time spent inside the residence.
Definition 4 (Stay region)
A stay region is a cluster satisfying the minimum presence constraint defined as:
(2) 
where is the presence threshold.
Example 3
The cluster in Figure 6.(a) is a stay region if . Conversely, if , the time spent in is not enough for the cluster to represent an object’s residence.
A property, which will be recalled later on, is that the minimum presence constraint is monotone, i.e. if the constraint is satisfied by stay region , then it is also satisfied by any stay region such that .
We now turn to consider sequences of stay regions and the notion of segmentation. A segmentation is a partitioning of a trajectory in a sequence of disjoint segments that can represent either stay regions or segments of unclusters points. Segmentation is defined with respect to the three parameters: . More formally:
Definition 5 (Clusterbased segmentation)
Let be a trajectory and the segmentation parameters. A segmentation is a set of disjoint segments , covering the whole trajectory where:

are stay regions satisfying the following conditions:

Stay regions are temporally separated

Stay regions are of maximal length, i.e. any point that can be included in the cluster without compromising the temporal separation of the clusters is included.


are possibly empty transitions. Transitions do not include any point that can be added to stay regions.
A segmentation can be represented as follows: . The sequence of stay regions is referred to as path.
Example 4
Figure 7 shows a segmentation comprising two stay regions w.r.t. : where: , . The stay regions are maximal. The object moves straightforwardly from to , next it experiences a period of absence from and finally leaves it.
3.3 Properties of the model: spatial separation
Following the definition of segmentation, the stay regions in a path are temporally separated. A straightforward question is whether the stay regions are also separated in space. Indeed spatial separation is a natural property of ’conventional’ clusters. In our model, however, the situation is slightly different because the trajectory describes an evolving phenomenon, therefore the notion of spatial separation requires a more precise characterization that takes time into account. We begin with a general definition of spatial separation between two stay regions, next we discuss some key properties that are at the basis of the algorithm presented next. Basically, a stay region is spatially separated by if no point exists in either or in the corresponding local noise that is reachable  in the DBSCAN sense  from a point of . In other words, while residing in the moving object has to be sufficiently far from even during the periods of absence. Formally:
Definition 6 (Spatial separation)
Let , be two stay regions in a path, nonnecessarily consecutive. We say that is spatially separated by , denoted , if no point belongs to the neighborhood of any core point (i.e. is not reachable from ). Two stay regions that are not spatial separated are said to overlap.
It can be shown that the relationship of spatial separation between stay regions is asymmetric.
(3) 
Example 5
The next concept is that of Minimal Stay Region (MSR). This concept is at the basis of the clusterbased segmentation algorithm. In essence, the MSR is the ’seed’ of a stay region. Formally:
Definition 7 (Minimal Stay Region)
The MSR of a stay region (w.r.t. ), denoted , is the stay region of minimal length contained in that is created first in time.
Example 6
The trajectory [1,7] in Figure 9.(a) is a stay region (w.r.t. K=4 ) and the MSR is the connected interval [2,5]. Note that the subtrajectory [1,4] is not a stay region because it does not contain a cluster of at least 4 elements. The cluster is only created at time . At that time, the cluster of minimal length is [2,5].
From the definition of segmentation, we can derive the following Theorem stating a necessary condition on the spatial separation of consecutive stay regions:
Theorem 1
For any pair of consecutive stay regions , it holds that the MSR is spatially separated from , namely .
proof 1
The proof is by contradiction. Suppose that is not separated from . Based on Definition 6, at least one point exists in the set that is directly reachable from . Let be the point with lowest index reachable from and consider the segment . We see that: a) no other cluster can exist in between and because is the lowest index; b) the segment satisfies the minimum presence constraint. Thus is a stay region in the path. However, that contradicts the assumption that is a cluster of maximal length. Therefore must be separated from the previous stay region, which is what we wanted to demonstrate
The next two corollaries provide a motivation for specific mobility behaviors that can be observed in a trajectory. In particular Corollary 1 states that two consecutive stay regions can spatially overlap for some time. The intuition is that when the object leaves a residence for another residence, after a while it can start moving back gradually to the previous region. Corollary 2 states that two nonconsecutive stay regions, even identical in space, but frequented in different periods, are treated as two different stay regions. In other terms, nonconsecutive stay regions can overlap. Formally:
Corollary 1
Let be two consecutive stay regions. The points in following in time the minimal stay region may be not spatially separated from . We refer to this property as weak spatial separation.
Corollary 2
Two nonconsecutive stay regions can overlap
Finally, the following theorem reformulates the notion of path in more specific terms. It follows straightforwardly from the above results.
Theorem 2
A path in a trajectory (w.r.t. ) is a sequence of temporally separated stay regions of maximal length and possibly pairwise weakly spatially separated
An important property is the following.
Corollary 3
The path in a trajectory may be not unique.
Example 7
Figure 10 shows two different segmentations for the same trajectory, both including two stay regions . Such regions are however selected based on different criteria. (a) is the stay region that is created first in time after . (b) is the stay region with the highest number of points after .
4 The SeqScan algorithm and the analysis of the temporal parameter
Based on the model, we describe the SeqScan algorithm for the clusterbased segmentation of a trajectory. Next we discuss the problem of how to choose the temporal parameter.
4.1 The segmentation algorithm
We have seen that the segmentation may be not unique. Therefore, we need to specify the criterion based on which selecting the stay regions of the sequence. We choose the following criterion: following the temporal order, the first cluster that satisfies the minimum presence constraint becomes the next stay region in the sequence. This criterion has an intuitive explanation: an object resides in a region until another attractive residence is found. The resulting path is called hereinafter first path. The SeqScan algorithm for the extraction of the first path is presented in the following:
Overview.
The SeqScan algorithm extracts from the trajectory a sequence of stay regions, based on the three input parameters . The noise points can then be obtained by difference from and straightforwardly classified in transition and local noise points. The algorithm scans the trajectory, iterating through the following phases: i) Find a Minimal Stay Region. Such MRS becomes the active stay region. ii) Expand the active stay region. iii) Close the active stay region. Once closed, a stay region cannot be expanded anymore. More specifically:

Search: the algorithm runs the DBSCAN algorithm on the spatial projection of the input sequence (i.e. spatial points). The clustering algorithm processes the points in the temporal order, progressively aggregating points in clusters. The cluster that for first in time satisfies the minimum presence constraint determines the new MSR . becomes the active stay region.

Expand: the active stay region is expanded. The question at this stage is how to determine the end of the expansion and thus the break of the segment. We recall that, in the stay region model, a point that is not reachable from a cluster can indicate either a temporary absence, or a transition or be an element of a more recent stay region. Therefore such a point cannot be correctly classified, until the movement evolution is known. The proposed solution is detailed next.

Close: the active stay region is deactivated, or closed, when a more recent MSR is found. Such MSR becomes the new active stay region . A closed stay region is simply a stay region in its final shape.
Detailed algorithm.
The pseudocode is reported in Algorithm 1. At each step, the algorithm tries first to expand the active stay region , and if that is not possible, tries to create a new MSR . To perform such operations, the algorithm maintains two different sets of points that are clustered incrementally using the Incremental DBSCAN algorithm (Ester et al, 1998). These sets are called and , respectively. represents the Context of the active stay region , namely the set of points that at each step can be used for the expansion of the cluster. Such points follow the previous stay region in the sequence, thus is separated from . The set is the Pool of points following in time the active stay region and representing the space where to search for the next MSR. Accordingly is temporally separated from . When a new point is added to either C or P, the set is clusterized incrementally using the Incremental DBSCAN technique(Ester et al, 1998). The processing of the input point is thus as follows:

is first added to the Context . If the point can be added to the current cluster, then the stay region is prolonged to include the point. Next the Pool is reset to the empty set.

if cannot be added to the active stay region, then is added to the Pool . If a MSR can be created out of P then such a MSR becomes the new active stay region . Accordingly, is closed, the Pool becomes the Context for and is reset to the emptyset.
The runtime complexity of SeqScan is that of Incremental DBSCAN, i.e. (Ester et al, 1998; Gan and Tao, 2015).
Example 8
We illustrate the algorithm through an example focusing on the expansion part. Consider a trajectory T=[1,13]. The clustering parameters are set to: K=4, , sufficiently small. We analyze the expansion of the active stay region , starting from the MSR depicted in the Figure 11.(a). For every subsequent point, we report the change of state defined by the triple: active stay region, C, P.

State: , C= [1,5], P=

Read point: 6. The point cannot be added to the active stay region, thus the state is: , C= [1,6], P=[6,6]

Read point: 7. The point cannot be added to the active stay region. State: , C= [1,7], P=[6,7]

Read point 8. The point can be added to the active stay region. State: , C=[1,8], P=.

Read point 9. The point cannot be added to the active stay region. State: , C=[1,9], P=[9,9]

Read point 10, as above. State: , C=[1,10], P=[9,10]

Read point 11, as above. State: , C=[1,11], P=[9,11]

Read point 12, as above. State: , C=[1,12], P=[9,12].

Read point 13. The point cannot be added to the active stay region. However, the insertion of the point in P, i.e. P=[9,13], generates a new stay region. Accordingly is closed, , C=[9,13], P=. The scan is terminated
The final stay regions are thus and . The noise points can then be classified. Points 2, 6,7 fall in the temporal extent [1,8] of thus are local noise; point 9 is a transition point
Theorem 3
Algorithm 1 computes the first path, if any path exists in the input trajectory.
proof 2
We need to prove that the resulting stay regions are maximal, temporally separated and pairwise weakly spatially separated. Moreover, every stay region is the first to be created after the previous one. The reasoning is as follows. The algorithm builds a stay region by expanding the first MSR that is encountered. Further the stay region is expanded based on the Context that includes all of the points following the end of the previous stay region, thus all those that potentially can be added to the stay region. The stay region is thus maximal and the first to be created. The stay regions are weakly spatially separated because when a MSR is found in the Pool , it cannot contain points ’close’ to the previous stay region (otherwise such point would be added to that stay region). Yet, once the MSR is created, the subsequent points that are added to the active stay region during the expansion phase can be located even in close proximity with the preceding stay region. The stay regions are also temporally separated because stay regions are created and next expanded from the two sets and that by definition are separated from the previous stay region.
4.2 Choice of the ’presence’ parameter
SeqScan requires in input the presence threshold parameter . A question of practical relevance is how to set the value for this parameter. In this section we analyze the relationship between and the number of stay regions. We recall that the presence threshold somehow constrains the temporal granularity of the stay regions in the path. The purpose of this analysis is to help determine the desired level of temporal granularity. The Optics system (Ankerst et al, 1999) has a similar intent, though applied to a density parameter of DBSCAN, and not to time as in our case.
Consider a trajectory and let be the function yielding the number of clusters in , for values of . The other parameters are fixed. We show that the number of stay regions remains constant for values of ranging in properly defined intervals. That is, the function has a stepwise behavior. The proof is in two steps: Lemma 1 demonstrates that the number of stay regions that we obtain is the same if we consider the sequences of MSRs in place of stay regions. This result is next used in Theorem 4 to prove that the function is stepwise.
Lemma 1
Let and the two sequences of minimal stay regions in obtained with and respectively (w.r.t. density parameters ). These two sequences and are identical iff the corresponding stay regions are identical.
proof 3
We prove the implication (the other way is trivial). Consider for a generic index , the equality . By definition of minimal stay region, every element of is reachable  in the DBSCAN sense  from . Thus every element of is also reachable by . Similarly every element of is reachable from . Thus the two stay regions and are identical.
The next Theorem shows that the number of stay regions remains constant for values of ranging in welldefined intervals. This provides the ground for the computation of .
Theorem 4
Consider a trajectory . Let be the sequence of stay regions obtained with parameter and the presence value in the MSRs . It holds that:
(4) 
proof 4
Let (otherwise the case is trivial). We want to prove that . We recall that the SeqScan algorithm scans the trajectory until a minimal stay region is found, hence such a cluster is expanded until a new, spatially separated MSR is detected. As the value is lower than the presence in any minimal stay region, none of the stay regions in is filtered out. Similarly, no additional minimal stay region can be found. The sequence of minimal stay regions is identical, and thus for Lemma 1 also the sequences of stay regions, i.e. that is what we wanted to demonstrate.
The function is given a constructive definition in Algorithm 2. This algorithm runs SeqScan multiple times with different values of the parameter until the number of resulting stay regions is 0. The presence threshold is initially set to . We illustrate the iterative process as follows. After the first run, SeqScan returns a sequence of stay regions, based on which, the minimum value of presence in the respective MSRs is computed. Such a value, say , forms the upper bound of the first interval . For values of falling in such interval, the number of stay regions is . Next, SeqScan is run with ( with is a small constant used to handle the discontinuity) to possibly determine the second interval . The process iterates until the terminating condition is met.
4.3 Examples: SeqScan at work
We conclude this section illustrating the three major typologies of patterns that can be detected by SeqScan: the linear ordering of clusters with local noise and transitions; weakly separated consecutive clusters; and overlapping nonconsecutive clusters. The patterns are shown in Figure 12. The trajectories have been generated manually.

Pattern 1: linear ordering of stay regions with local noise. The trajectory is displayed in Figure 12.(a). SeqScan is run with parameters , . The result is shown in Figure 12.(b). It can be seen that the segmentation correctly identifies the two clusters, the transition and some local noise associated with one of the clusters.

Pattern 2: weak separation of consecutive stay regions. The trajectory in Figure 12.(c) contains two clusters that are spatially separated only for a limited period of time. In particular it can be noticed that the object moves back from the second region to the initial region. We run with the same parameters as above, we obtain the two stay regions reported in Figure 12.(d). The two stay regions are evidently not disjointed and this is coherent with the fact that consecutive stay regions can be weakly separated, in accordance with Corollary 1.

Pattern 3: nonspatially separated stay regions. The trajectory in Figure 12.(d) exemplifies the case of an object moving back and forth between two regions. The Figure shows are 4 clusters. Of these, the nonconsecutive clusters are overlapping. Coherently with Corollary 2, SeqScan detects the correct sequence of clusters.
5 Discovering derived patterns
We argue that the SeqScan framework can facilitate the discovery of additional mobility patterns. We refer to the patterns that are built on the notion of stay region as derived. In this section, we present an approach to the discovery of recursive movement patterns (Li. and Han, 2014; BergerTal and BarDavid, 2015). This type of movement can be broadly defined as repeated visitation to the same particular locations in a systematic manner (BergerTal and BarDavid, 2015). Detecting which and how those locations are frequented can reveal important features of the object behavior. We focus, in particular, on the detection of locations that are frequented regularly on a periodic basis. To avoid possible conflicts with the terminology used in the rest of the article, we call zones the ’locations’ visited by an object. We split the problem in two subproblems:

To discover the zones

To discover the periodic zones, i.e., , where is the period and the zone where the object is located at time .
Coherently with the work presented so far, the overarching assumption is that the behavior may contain noise.
5.1 Discovery of zones
Periodic zones are commonly modeled as spatial clusters (Li. and Han, 2014; Cao et al, 2007). To extract these clusters, Cao et al. use DBSCAN (Cao et al, 2007), while the MoveMine project (Li et al, 2011) the Worton method (Worton, 1989). All of these clustering techniques ignore time, i.e. are spatialonly.
We argue that the use of spatialonly clustering, in place of spatiotemporal clustering, may result into a rough approximation that impacts the quality of the analysis. To begin, we observe that objects spend some time inside a zone. Therefore, if the location is sampled at a frequency that is relatively high with respect to the time spent inside a zone, a visit results in a dense set of sample points. While such a set can be straightforwardly modeled as a cluster, it is highly unlikely that the clusters at different times are perfectly identical. That suggests modeling a frequented location as set of clusters. This change of perspective has important implications. For example, it can be shown that spatialonly clustering can generate clusters including points that in reality represent noise. An example can better explain the problem. Consider the points of a trajectory projected on plane and assume that these points form the clusters as shown in Figure 13.(a). These clusters appear compact, i.e., no noise. In reality, there are 4 agglomerates, i.e. spatiotemporal clusters, along with a few noise points. These agglomerates are pairwise close to each other, thus, once projected on plane, collapse in a unique spatial cluster, which absorbs the noise points. As a result the noise information is lost. Clearly, that can be avoided taking into account time. Another important reason for using spatiotemporal clusters, in particular stay regions, in place of spatialonly clusters, is that the individual movement can be given a discrete sequential representation, which can be more easily manipulated.
In the light of these considerations, we propose the following approach: to extract the sequence of stay regions and then group together the stay regions that are close to each other, based on a properly defined notion of proximity, to finally associate each such groups a zone. We recall that, based on Corollary 2, two stay regions can overlap. We need, however, a more restrictive and noise independent notion of cluster proximity, therefore we introduce the concept of spatial similarity (of clusters). Similar stay regions form a zone.
In the following we detail the process starting from the notions of spatial similarity and zone.
Spatial similarity of clusters. We say that two stay regions are spatially similar if there is at least one core point of that is directly reachable from (in the DBSCAN sense), or viceversa, there is at least one core point of that is directly reachable from . We quantify the spatial similarity as the maximum percentage of core points that are directly reachable from the core points of the other set. More formally: let be the set of core points in stay region falling in the neighborhood of some core point in (). We define the function of spatial similarity as follows:
(5) 
The two stay regions are spatially similar if
, where is the similarity threshold.
Note that this notion of similarity is not affected by the relative size of clusters, in other terms the similarity can be 1, even though the clusters are of very different size.
Zones. Similar stay regions can be grouped in classes. The similarity class of the stay region is defined recursively as follows: contains and all of the regions similar to at least one region of the class. A similarity class is maximal, that is every stay region that can be added to the class, belongs to the class. Moreover, the relation of spatial similarity induces a partition over the set of stay regions. For every similarity class we define the corresponding zone as follows. The similarity class associated with a zone is the projection on space of the union set of the stay regions in
(6) 
A nice property that follows from the above definitions is that a zone is itself a cluster. However, in contrast with spatialonly clusters, zones do not contain noise. An example is shown in Figure 13.(b). The 4 stay regions of the Figure can be pairwise grouped to form 2 zones, Zone1 and Zone2. Note that, at this stage, we can rule out the local noise because it is not relevant for the problem at hand. Thus the trajectory can be rewritten as sequence of temporally annotated zones for example using the formalism of symbolic trajectories (Güting et al, 2015): . As a result, we obtain a simple and compact representation of the trajectory.
5.2 Discovery of periodically visited zones
The zones may be be visited periodically. The period, however, is not known, thus can range between 1 and where is the length of trajectory, moreover it can be imprecise.
To our knowledge the only approaches dealing with the periodicity of locations are built on spatialonly clustering (Li. and Han, 2014; Cao et al, 2007; Li et al, 2011).
For the analysis of location periodicity, we propose to leverage the symbolic representation of the trajectory obtained at the previous step, map it onto a time series and use a technique for the periodicity analysis of symbolic time series with noise. Specifically, we utilize the WARP technique (Elfeky et al, 2005)^{3}^{3}3The implementation of the algorithm has been kindly provided by M. Elfeky, coauthor of WARP (Elfeky et al, 2005). Another implementation is available on: //github.com/SerafimEnd/periodicityresearch.
WARP. Consider a time series of elements. The key idea underlying WARP is that if we shift the time series of positions and compare the original time series to
the shifted version, we find that the time series are very similar, if is a candidate period (Elfeky et al, 2005). Therefore the greater the number of matching symbols, the greater the accuracy of the period. For every possible period , WARP computes the similarity between the time series and the time series shifted positions, using Dynamic Time Warping (DTW) as similarity metric. The underlying distance function measures whether two symbols are identical or not. The value of the distance ranges between and , where
indicates that the time series of length is perfectly periodic.
The confidence of a period is defined as: .
Process. We obtain the time series from the symbolic trajectory resulting from the previous phase as follows. First, we specify the temporal resolution of the time series, e.g. week, year. Next, for every temporally annotated zone, we create a sequence of repeating symbols, one per time unit. We repeat the same process with the transitions, which are assigned a systemdefined symbol. The resulting time series is given in input to WARP, which returns the candidate periods for every period along with the confidence value. The periods with high confidence are those of interest. An application of the method will be shown in the next section.
6 Experimental evaluation of SeqScan
We turn to discuss the process of SeqScan validation. The methodology consists of two phases:

External evaluation of SeqScan. We confront the clustering with ground truth where the ground truth consists of synthetic trajectory data;

Evaluation of the technique for the discovery of periodic locations. We compare our approach with the solution developed in the MoveMine project (Li et al, 2011), based on a real dataset.
For the efficiency aspects, we refer the reader to earlier work (Damiani et al, 2014). The experiments are conducted using the MigrO environment, a plugin written in Python for the Quantum GIS system^{4}^{4}4http://www.qgis.org providing a number of functionalities for SeqScanbased analysis, including visualization tools (Damiani et al, 2015). For the statistical tests, we use the R system^{5}^{5}5https://www.rproject.org/. The hardware platform consists of a computer equipped with Intel i74700MQ, 2.40GHz processor with 8 GBytes of main memory.
6.1 Part 1: external evaluation of SeqScan
In general, the ground truth consists of labeled points where the labels specify the categories the points belong to. The ground truth can be either generated by a simulator or consist of real data labeled by domain experts. In both cases, ensuring a fair evaluation may be problematic: real trajectory data is commonly of low quality (e.g. missing points), while synthetic datasets can be engineered to match assumptions of the occurrences and properties of meaningful clusters (Farber et al, 2010). For a sustainable and fair evaluation, we present a different methodology. We still use synthetic data, nevertheless the trajectories are generated by a simulator grounded on an independent model designed for the simulation of the animal movement. Moreover, the comparison is performed using blind experiments (see also (Groeve et al, 2016)
for a similar approach). The experimental setting, i.e. the synthetic dataset and the evaluation metrics used for the experiments, is detailed in the following.
Synthetic data. Animal trajectories are simulated as a stochastic movement process (sensu(Patlak, 1953)) in which animals move on a landscape interspersed by randomly distributed resource patches. The stochastic movement process is for the animal follows that of Van Moorter et al. (Moorter et al, 2009), in which animals move with in a fixed step length, with their movement directions biased towards resource patches and (specifically with the bias was proportional to patch attraction values, where closer resource patches to the animal’s position were more attractive to account for the costs of movement). In addition, following Van Moorter et al. (Moorter et al, 2009) each animal had a twocomponent spatial memory that reinforces attraction towards previously visited areas. This attraction feedback allows the movement model to capture the spatiallylocalized nature of movement behavior observed in many empirical animal trajectories (see (Moorter et al, 2009) for further details). In order to provide sufficiently complex trajectories for the evaluation of SeqScan, we generated several behavioral modes of movement (Morales et al, 2004) – namely residence, excursion and migration – by altering the relationship between animal movement and the food resources. Each movement mode is the result of an underlying set of stochastic movement rules that generates certain realized characteristic spatial pattern of animal relocations.
The ground truth is finally extracted from the simulated trajectories by mapping the ecological concepts onto the concepts of our model. The process has been applied to create a dataset of 12 spatial trajectories of 19,500 points each, with labeled points indicating stay region, transition, local noise, and time interval of 2 hours. This dataset, called hereinafter ’animal dataset’, is the ground truth. Two examples trajectories are shown in Figure 14. The full set of trajectories is reported in Appendix while summary statistics on the distribution of points and the number of clusters in each trajectory are reported in Table 2.
TrajId  number of clusters  % clustered points  % local noise  % transition points 
Ind6  7  87.06  10.49  2.45 
Ind41  7  91.09  6.50  2.41 
Ind1  7  92.06  4.80  3.14 
Ind35  6  85.27  12.44  2.28 
Ind10  6  85.85  12.14  2.00 
Ind39  6  86.45  11.57  1.97 
Ind14  6  86.57  11.54  1.88 
Ind25  6  86.23  11.36  2.40 
Ind17  6  86.61  11.26  2.13 
Ind12  6  87.41  10.12  2.47 
Ind8  6  88.17  9.70  2.12 
Ind49  6  88.58  8.88  2.54 
Evaluation metrics.
For deliberate redundancy, we choose two metrics from different families, setmatching and counting pairs, respectively (Basu et al, 2004). Further, we consider a third metric counting the different number of clusters as simple measure of structural similarity of segmentations. Let be the set of ’true’ clusters, the set of stay regions detected by SeqScan, the total number of clustered points in the SeqScan output, and the total number of clustered points in the ground truth. The metrics are described in the sequel while their definition is reported in Table 3:
Metric  Defs 

HPurity (R, S)  Purity(R,S)= 
InvPurity(R,S)=  
HPurity (R,S)=  
Pairwise Fmeasure (R,S)  TP=#pairs assigned to the same cluster is R and S 
FP=#pairs assigned to different clusters in R but to the same cluster in S  
FN=#pairs assigned to different clusters in S but to the same cluster in R  
Precision=  
Recall=  
Fmeasure (R,S)=  
Diff (R,S) 

Harmonic mean of Purity and Inverse Purity (Amigó et al, 2009) hereinafter denoted HPurity. In general, the Purity metric penalizes clusters containing items from different categories, while it does not reward the grouping of items from the same category. By contrast, Inverse Purity rewards grouping items together, but it does not penalize mixing items from different categories. The HPurity metric mediates between Purity and Inverse Purity.

Pairwise Fmeasure. This metric represents the harmonic mean of pairwise precision and recall computed over the contigency table specifying the number of pairs that are correctly/incorrectly classified as members of an identical/different cluster in S and R, respectively
(Basu et al, 2004; Amigó et al, 2009). 
The third metric, Diff in brief, computes the difference between the number of stay regions and the number of clusters
6.1.1 Experiments
We present a series of 5 experiments focusing on the following two aspects:

Quantitative evaluation: we present a systematic approach to the quantitative evaluation of the clusterbased segmentation against ground truth.

Parameter sensitivity: we analyze the sensitivity of SeqScan to key internal and external parameters.
Experiment 1: structural comparison and impact of the parameter.
For every trajectory of the dataset, SeqScan is run with parameters that only differ for the value of the presence , set to 20 days and 100 days respectively. In both cases the density parameters are: . Such parameters are chosen through an iterative process. The resulting number of clusters contrasted with the true number is reported in Table 4. With days the number of stay regions in the trajectory segmentation is substantially close to the number of clusters in the ground truth while with
days the number of stay regions is substantially different (the statistical significance is evaluated through the KruskalWallis test
(Gibbons and Chakraborti, 2011)). Visual analysis can provide further information.As an example, Figure 15 illustrates the segmentation of the trajectories IND1 and IND14. The segmentation of the trajectory IND1 in Figure 15.(a) for days, contains the same number of clusters of the ground truth in Figure 14. Moreover there is visual evidence of good matching of the segmentation with the ground truth. By contrast, the segmentation in Figure 15.(b) only contains four large clusters. In this sense, the parameter allows for the tuning of the temporal granularity of clusters. In the second trajectory, IND14, the number of clusters detected by SeqScan with days is 8 against the true 6 clusters. It can be noticed that SeqScan recognizes as distinct two clusters (cluster 1 and 2) that in reality are part of a unique cluster in the ground truth. With days, the number of clusters decreases to 3.
TrajectoryId  Number of clusters  

Ground truth  SeqScan: =20days  SeqScan: =100days  
IND1  7  7  4 
IND6  7  5  3 
IND8  6  7  5 
IND10  6  6  2 
IND12  6  4  3 
IND14  6  8  3 
IND17  6  7  3 
IND25  6  6  4 
IND35  6  8  5 
IND39  6  8  3 
IND41  7  6  4 
IND49  6  7  1 
Experiment 2: analysis of the quality indexes.
The visual comparison performed at the previous step, though useful, does not provide any quantitative measure. To that end, we run SeqScan with the ’good’ parameters determined at the previous step: and compute, for every trajectory, the quality indexes resulting from the comparison of the SeqScan outcome with the ground truth. Table 5 reports the indexes HPurity and Pairwise FMeasure for every trajectory. It can be seen that the two indexes are substantially aligned and that overall the quality of the clustering is high. It can be noticed however that the Hpurity value of the trajectory IND14 seen earlier  the one reporting the highest structural difference  is among the lowest in the table. This means that clusters may lack either compactness or homogeneity, in line with the visual analysis. By contrast the quality of the segmentation of IND1 is quite high, again in line with the structural comparison. Overall, the indices show a good matching with the ground truth both at the level of structure and of single clusters.
TrajId  Hpurity  Pairwise Fmeasure 

IND1  0.98  0.95 
IND6  0.89  0.73 
IND8  0.90  0.84 
IND10  0.93  0.86 
IND12  0.93  0.83 
IND14  0.87  0.84 
IND17  0.95  0.89 
IND25  0.9  0.81 
IND35  0.91  0.83 
IND39  0.91  0.85 
IND41  0.97  0.93 
IND49  0.96  0.92 
Experiment 3: noise analysis.
In this experiment we analyze the contribution of the local noise to the quality of clustering. We recall that the unclustered points can represent either transitions or local noise.
For this experiment, we contrast the quality of clustering in presence of local noise with the quality of the clustering in absence of local noise (i.e. the local noise points are seen as elements of the clusters). For the evaluation, we use the Pairwise Fmeasure because seemingly less favorable than HPurity. Table 6 reports the value of the index in the two cases. The KruskalWallis test confirms the significance of the discrepancy that can be seen in the table, or, put in other terms, that the local noise has an impact on the quality of clustering.
TrajId  Pairwise Fmeasure  

no local noise  with local noise  
IND1  0.99  0.95 
IND6  0.81  0.73 
IND8  0.98  0.84 
IND10  0.97  0.86 
IND12  0.92  0.83 
IND14  0.93  0.84 
IND17  0.98  0.89 
IND25  0.90  0.81 
IND35  0.96  0.83 
IND39  0.96  0.85 
IND41  0.99  0.93 
IND49  0.97  0.92 
Experiment 4: analysis of the parameter. In this experiment, we analyze the behavior of the function describing the relationship between the presence parameter and the number of stay regions detected by SeqScan. We recall that the function is computed by the Algorithm 2 that repeatedly runs SeqScan with different values of . This function is implemented as part of the MigrO environment. In this experiment, the function is built by running SeqScan with the usual density parameters and and with varying between 0 and the duration of the trajectory. The number of iterations is limited to 160, i.e. SeqScan is invoked 160 times. Figure 16 displays the plots of for the trajectory IND1. It can be seen that the maximum number of clusters is obtained with . In particular, the segmentation of IND1 (Figure 16) consists of 7 clusters for ranging between 0 and 32 days. This is in line with the result in Table 4 reporting the number of clusters for days.


Experiment 5: sensitivity to the sampling rate.
For this experiment, the trajectories are resampled considering time intervals of 4, 8, 16, 32, 64 hours (we recall that in the animal dataset the time interval has a width of 2 hours). Next, SeqScan is run over the resampled trajectories and the result contrasted with the ground truth, using two of the quality indexes discussed earlier, i.e., the difference in the number of clusters with respect to the regular trajectory (normalized) and the Pairwise Fmeasure. SeqScan is run with clustering parameters =200, =20 and =50 points. The corresponding graphs for one of the trajectories are reported in Figure 17. It can be seen that for lower sampling rates, the normalized difference in the number of clusters increases, while the quality of the cluster (i.e. Fmeasure) decreases. While this is the expected behavior, more interesting is the fact that the quality of clustering is not dramatically compromised if the sampling rate is reduced by 2 and even 4 times (i.e. time interval of 4 and 8 hours). This trend can be observed also in the other trajectories.
6.2 Part 2: evaluation of the SeqScanbased technique for the discovery of periodic locations
We turn to use SeqScan with real data and confront
the solution proposed for the discovery of periodic locations with the MoveMine approach (Li et al, 2011).
We use a dataset containing the GPS trajectory of one eagle observed for nearly three years while flying between US and Canada. The sample points have been collected between mid January 2006 and end December 2008 at a sampling rate that is highly irregular. The data can be downloaded from the Movebank database ^{6}^{6}6//http:www.movebank.org. Study: Raptor Tracking: NYSDEC. Notably, this dataset is the same used in the MoveMine project. Some cleaning operations are preliminarily performed over data. As a result, we obtain a trajectory of 14,442 points, extending over 1080 days, from 2006 Jan 15 until 2008 Dec 30
with an average step length of 3210 meters.
The trajectory and its spatiotemporal representation is reported in Figure 18.(a) and 18.(c), respectively.
In the following, we analyze: (a) the zones, (b) the periodicity of zones.
Zones discovery.
The analysis is performed in three main steps:
Step 1. Compute the sequence of stay regions. We run SeqScan with parameters: .
We obtain 12 stay regions (numbered from 1 to 12). The stationarity index (Damiani et al, 2016) is generally high, meaning that the local noise in the region is limited and thus the staying is ’temporally dense’.
We recall that the transitions and the local noise are not relevant for this kind of analysis.




Step 2. Compute the similarity classes. We set the parameter and obtain four classes, each containing three stay regions: . The similarity table is reported in Figure 18.(d).
Step 3. Compute the zones and the number of visits.
For each class we compute the corresponding zone as union set of the stay regions. The zones are denoted: .
The sequence of 12 stay regions can be rewritten in terms of zones:
. The stay regions and the grouping in zones are reported in Figure 18.(b).
Every zone is visited three times.
It is evident that the subsequence repeats itself, although with some irregularity. The following periodicity analysis provides further information.
Periodicity analysis. We analyze first the periodicity of single zones and then of the entire trajectory. The temporal resolution of time series is set to 1 week. For each zone, we create a time series as follows. We consider the trajectory in the period between the beginning of the first visit and the end of the last visit. We split the temporal extent of the trajectory in weeks. Hence for every week, if the object is inside the zone at any instant, we create the symbol ’1’, ’0’ otherwise. We recall that the local noise is overlooked at this stage, thus the object is assumed be continuously present inside a stay region. We run the WARP algorithm over the time series and we select the smallest period with the highest confidence value. As a result, we obtain: two zones ( have periods 53 and 51 weeks, respectively, with maximum confidence; the other two zones have periods 48 and 55 weeks, respectively. The confidence of the period of zone , is the lowest (0.9) among the zones. We recall that Warp is built on the DTW distance which allows an elastic shifting of the time axis to accommodate similar, yet outofphase, segments (Elfeky et al, 2005), therefore, a period can have maximum confidence although is not perfect. As we will explain in a while, we consider the set as a unique zone. From the analysis of the time series created out of the sequence of zones and transitions using an appropriate number of symbols, we find that the period of the behavior is 52 weeks with maximum confidence. Figure 19 illustrates the temporal sequence of zones traversed during the 3years travel.
Comparison. The map generated by MoveMine (Figure 9 in (Li et al, 2011)) highlights 3 reference spots in the areas of New York, Great Lakes and Quebec, respectively.
Reference spot/behavior  Period (days)  Corresponding zone/behavior  Period (weeks) 

1  363  51  
2  363  53  
3  364  51  
1232  363    52 
There is evidence that the reference spots substantially match our zones. The only exception is the reference stop 1 (New York area), which, in our model, covers both zone and . For homogeneity, as said above, these two zones are considered as a unique region. The periods for each reference spot and corresponding zone/s, as well for the whole sequence (behavior), are summarized in Table 7. It can be seen that the results are coherent.
To provide further details, the behavior of the eagle is described in MoveMine as follows (Li et al, 2011): ’This eagle stays in New York area (i.e., reference spot 1) from December to March. In March, it flies to Great Lakes area (i.e., reference spot 2) and stays there until the end of May. It flies to Quebec area (i.e., reference spot 3) in the summer and stays there until late September. Then it flies back to Great Lakes again staying there from mid October to mid November and goes back to New York in December’. Interestingly, if we compare this behavior with our result, we can see that the sequence of reference stops is slightly different from the sequence of zones. In particular, in MoveMine, the flight from Quebec to the New York area, includes a stop at the area of Great Lakes, which our method seems not to recognize. Indeed, if we take a closer look, we can see that such a stop has a short duration ( 20 days). Therefore, for how the parameters are chosen, SeqScan does not recognize such clusters as stay regions. Note that such an observation has been made possible by the segmentation mechanism, which discriminates between clusters and transitions, allowing for a detailed inspection of the behavior.
In summary, the two approaches appear substantially aligned. We emphasize, however, that there is a fundamental difference between the two methods. MoveMine detects the reference spots as spatialonly clusters, and exploits signal processing techniques to extract from a noisy signal the sequence of temporally separated regions. Our technique does the opposite: it starts from the extraction of temporally separated regions, through the use of SeqScan, and finds the zones. Consequently, the noise can be easily separated from the clusters at early stage, and that simplifies the analysis.
7 Discussion
In this work, we have used a research methodology that combines the investigation of a novel theoretical framework with an extensive validation of the technique. Actually, we have chosen to combine the two streams to ensure a more robust evaluation of the analytical framework, also in view of a possible deployment. Additional considerations:

Validation strategies. We have used different approaches to evaluate the effectiveness of SeqScan. Although not reported in this article for the sake of focus, we have contrasted SeqScan with two algorithms: the place detection algorithm proposed by Yu Zheng et al. (Zheng and Zhou, 2011) and STDBSCAN (Birant and Kut, 2007)
. These two techniques, however, rely on conceptual models of movement that are different from the one we refer to, therefore the comparison is unfair. Actually, the notion of local noise does not have a counterpart in any existing technique we are aware of. Probably the most challenging question, with respect to validation, is whether the proposed solution can be effective in real applications and that motivates the concern for external validation practices
(Farber et al, 2010). To that end, in (Damiani et al, 2016) we have used a first approach where we evaluate SeqScan using real animal trajectory data. The problem with real data is that if the behavior is inherently complex and only known at macroscopic level (e.g. migratory behavior), domain experts may not be in the condition of classifying every point with sufficient confidence and thus the evaluation can be only conducted at a coarse level. In this sense, the use of a synthetic dataset built on an independent movement model conceptually encompassing the pattern of concern has dramatically improved the accuracy of the evaluation. 
Evaluation metrics. We have used Purity and Pairwise Fmeasure. Yet, these indexes are specific for the evaluation of traditional clustering while the segmentation problem, we are dealing with, is somehow different. Indeed, defining appropriate internal and external evaluation metrics for clusterbased segmentation is an open issue. A first proposal of internal indicator, called stationarity index is presented in (Damiani et al, 2016). Applied to single clusters, the stationarity index is an estimate of the ’temporal density’ in the cluster. This topic will be investigated as part of future work.

Generality of the proposed framework. As the external evaluation has been conducted on animal trajectories, one could raise the question on whether the scope of the solution is confined to the ecological domain. In reality, the model has been defined in a rigorous and general way, thus is prone to be applied in a variety of domains, such as human mobility analysis.
The results of the evaluation process can be finally summarized as follows:

The experiments show that overall the degree of matching of the SeqScan segmentation with the ground truth is high (Tables 46). We recall that we have used the same set of parameters for all of the trajectories. Therefore, it is likely that with a finergrained tuning of the parameters, the quality improves further. Importantly the ground truth is generated independently from the clustering while the evaluation has been conducted in a blind manner ignoring the simulation parameters. This is important for two reasons: it definitely supports the thesis that SeqScan can detect this class of patterns; and that the evaluation is fair.

For the practical application of SeqScan, the generation of the function , exemplified in Figure 16, can be extremely useful to determine a suitable set of values for , in the same spirit of Optics (Ankerst et al, 1999). In addition the experiments show that SeqScan is resilient to relatively low sampling rates.

Finally, a novel approach, grounded on the SeqScan framework, is proposed to support the discovery of periodic locations and behaviors. The approach can compete with stateoftheart techniques in detecting periodical behaviors with noise, while offering a flexible and principled solution.
8 Conclusions
To summarize, this article introduces the notion of clusteringbased segmentation and presents an algorithm, SeqScan, that leverages the densitybased paradigm to efficiently compute the segmentation of a trajectory based on spatial density criteria. Moreover, the article presents an extensive evaluation of the solution, which includes the comparison of the SeqScan clustering with the ground truth. The resulting framework can be extended to support the discovery of additional patterns. The trajectory dataset created as ground truth will be made publicly available. Additional information on the MigrO plugin for the QGIS environment implementing the key functionalities for the SeqScan analysis is available at: http://mdamiani.di.unimi.it/.
Acknowledgments We thank Walid Aref, Purdue University, for the discussion on the use of the WARP technique, and Roland Kays, NC Museum of Natural Sciences, for kindly providing the real data used in the experiments.
References
 Alewijnse et al (2014) Alewijnse S, Buchin K, Buchin M, Kölzsch A, Kruckenberg H, Westenberg M (2014) A framework for trajectory segmentation by stable criteria. In: Proc. ACM SIGSPATIAL
 Amigó et al (2009) Amigó E, Gonzalo J, Artiles J, Verdejo F (2009) A comparison of extrinsic clustering evaluation metrics based on formal constraints. Information Retrieval 12(4):461–486
 Ankerst et al (1999) Ankerst M, Breunig MM, Kriegel HP, Sander J (1999) Optics: ordering points to identify the clustering structure. In: Proc. ACM SIGMOD
 Aronov et al (2015) Aronov B, Driemel A, vanKreveld M, Löffler M, Staals F (2015) Segmentation of trajectories on nonmonotone criteria. ACM Trans Algorithms 12(2):26:1–26:28
 Basu et al (2004) Basu S, Banerjee A, Mooney R (2004) Active semisupervision for pairwise constrained clustering. In: Proc. SIAM International Conference on Data Mining
 BergerTal and BarDavid (2015) BergerTal O, BarDavid S (2015) Recursive movement patterns: review and synthesis across species. ESA Ecosphere 6(9):1–12

Birant and Kut (2007)
Birant D, Kut A (2007) Stdbscan: an algorithm for clustering spatialtemporal data. Data & Knowledge Engineering 60(1):208 – 221
 Buchin et al (2011) Buchin M, Driemel A, van Kreveld MJ, Sacristán V (2011) Segmenting trajectories: a framework and algorithms using spatiotemporal criteria. Journal Spatial Information Science 3(1):33–63
 Buchin et al (2013) Buchin M, Kruckenberg H, Kölzsch A (2013) Advances in Spatial Data Handling, Springer, chap Segmenting trajectories by movement states, pp 15–25
 Cao et al (2006) Cao F, Ester M, Qian W, Zhou A (2006) Densitybased clustering over an evolving data stream with noise. In: Proc. SIAM International Conference on Data Mining
 Cao et al (2007) Cao H, Mamoulis N, Cheung DW (2007) Discovery of periodic patterns in spatiotemporal sequences. IEEE Trans Knowledge and Data Engineering 19(4):453–467

Cerf et al (2008)
Cerf M, Harel J, Einhaeuser W, Koch C (2008) Predicting human gaze using lowlevel saliency combined with face detection. In: Advances in Neural Information Processing Systems, Curran Associates, pp 241–248
 CudréMauroux et al (2010) CudréMauroux P, Wu E, Madden S (2010) Trajstore: an adaptive storage system for very large trajectory data sets. In: Proc. IEEE International Conference on Data Engineering
 Damiani and Hachem (2017) Damiani ML, Hachem F (2017) Segmentation techniques for the summarization of individual mobility data. Wiley Interdisciplinary Reviews: Data Mining and Knowledge Discovery 7(6)
 Damiani et al (2014) Damiani ML, Issa H, Cagnacci F (2014) Extracting stay regions with uncertain boundaries from gps trajectories: a case study in animal ecology. In: Proc. ACM SIGSPATIAL
 Damiani et al (2015) Damiani ML, Issa H, Fotino G, Hachem F, Ranc N, Cagnacci F (2015) Migro: a plugin for the analysis of individual mobility behavior based on the stay region model. In: Proc. ACM SIGSPATIAL
 Damiani et al (2016) Damiani ML, Issa H, Fotino G, Heurich M, Cagnacci F (2016) Introducing ’presence’ and ’stationarity index’ to study partial migration patterns: an application of a spatiotemporal clustering technique. International Journal on Geographical Information Science 30(5):907–928
 Dodge et al (2008) Dodge S, Weibel R, Lautenschütz AK (2008) Towards a taxonomy of movement patterns. Information Visualization 7(34):240–252
 Edelhoff et al (2016) Edelhoff H, Signer J, Balkenhol N (2016) Path segmentation for beginners: an overview of current methods for detecting changes in animal movement patterns. Movement Ecology 4(1):21
 Elfeky et al (2005) Elfeky M, Aref W, Elmagarmid A (2005) Warp: time warping for periodicity detection. In: Proc. IEEE International Conference on Data Mining
 Esling and Agon (2012) Esling P, Agon C (2012) Timeseries data mining. ACM Computing Surveys 45(1):12:1–12:34
 Ester et al (1996) Ester M, Kriegel HP, Sander J, Xu X (1996) A densitybased algorithm for discovering clusters in large spatial databases with noise. In: Proc. International Conference on Knowledge Discovery and Data Mining
 Ester et al (1998) Ester M, Kriegel HP, Sander J, Wimmer M, Xu X (1998) Incremental clustering for mining in a data warehousing environment. In: Proc. VLDB
 Farber et al (2010) Farber I, Guennemann S, Kriegel HP, Kroeger P, Mueller E, Schubert E, Seidl T, Zimek A (2010) On using classlabels in evaluation of clusterings. In: Proc. International Workshop on Discovering, Summarizing and Using Multiple Clusterings
 Gan and Tao (2015) Gan J, Tao Y (2015) Dbscan revisited: misclaim, unfixability, and approximation. In: Proc. ACM SIGMOD International Conference on Management of Data
 Giannotti and Pedreschi (2008) Giannotti F, Pedreschi D (2008) Mobility, data mining and privacy: geographic knowledge discovery. Springer
 Gibbons and Chakraborti (2011) Gibbons JD, Chakraborti S (2011) Nonparametric statistical inference. In: International encyclopedia of statistical science, Springer, pp 977–979
 Groeve et al (2016) Groeve JD, de Weghe NV, Ranc N, Neutens T, Ometto L, RotaStabelli O, Cagnacci F (2016) Extracting spatiotemporal patterns in animal trajectories: an ecological application of sequence analysis methods. Methods in Ecology and Evolution 7(3):369–379
 Gudmundsson et al (2008) Gudmundsson J, Laube P, Wolle T (2008) Movement patterns in spatiotemporal data. In: Encyclopedia of GIS, Springer US, pp 726–732
 Gurarie et al (2009) Gurarie E, Andrews RD, Laidre KL (2009) A novel method for identifying behavioural changes in animal movement data. Ecology Letters 12:395–408
 Güting et al (2015) Güting R, Valdés F, Damiani ML (2015) Symbolic trajectories. Trans Spatial Algorithms and Systems 1(2):7:1–7:51
 Han et al (2011) Han J, Kamber M, Pei J (2011) Data mining: concepts and techniques. Morgan Kaufmann publishers Inc.
 Kang et al (2004) Kang J, Welbourne W, Stewart B, Borriello G (2004) Extracting places from traces of locations. In: Proc. ACM International Workshop on Wireless Mobile Applications and Services on WLAN hotspots
 Keogh et al (2001) Keogh E, Chu S, Hart D, Pazzani M (2001) An online algorithm for segmenting time series. In: Proc. IEEE International Conference on Data Mining
 Li. and Han (2014) Li Z, Han J (2014) Mining periodicity from dynamic and incomplete spatiotemporal data. In: Data Mining and Knowledge Discovery for Big Data, Springer, pp 41–81
 Li et al (2011) Li Z, Han J, Ji M, Tang LA, Yu Y, Ding B, Lee JG, Kays R (2011) Movemine: mining moving object data for discovery of animal movement patterns. ACM Intelligent Systems and Technology 2(4):1–32
 Michelot et al (2017) Michelot T, Langrock R, Bestley S, Jonsen I, Photopoulou T, Patterson T (2017) Estimation and simulation of foraging trips in landbased marine predators. Ecology 98 (7):1932–1944.
 Moorter et al (2009) Moorter BV, Visscher D, Benhamou S, Borger L, M B, Gaillard JM (2009) Memory keeps you at home: a mechanistic model for home range emergence. Oikos 118(5):641––652
 Morales et al (2004) Morales J, Haydon D, Frair J, Holsinger KE, Fryxell J (2004) Extracting more out of relocation data: building movement models as mixtures of random walks. Ecology 85(9):2436–2445
 Palma et al (2008) Palma AT, Bogorny V, Kuijpers B, Alvares LO (2008) A clusteringbased approach for discovering interesting places in trajectories. In: Proc. ACM Symposium on Applied Computing
 Parent et al (2013) Parent C, Spaccapietra S, Renso C, Andrienko G, Andrienko N, Bogorny V, Damiani ML, GkoulalasDivanis A, Macedo J, Pelekis N, Theodoridis Y, Yan Z (2013) Semantic trajectories modeling and analysis. Comput Surv 45(4):1–32
 Patlak (1953) Patlak CS (1953) Random walk with persistence and external bias. Bulletin Mathematical Biophysics 15(3):311–338
 Rasetic et al (2005) Rasetic S, Sander J, Elding J, Nascimento MA (2005) A trajectory splitting model for efficient spatiotemporal indexing. In: Proc. ACM International Conference on Very Large Data Bases
 Worton (1989) Worton B (1989) Kernel methods for estimating the utilization distribution in homerange studies. Ecology 70(1):164–168
 Zheng (2015) Zheng Y (2015) Trajectory data mining: an overview. ACM Trans Intelligent Systems and Technology 6(3):1–41
 Zheng and Zhou (2011) Zheng Y, Zhou X (2011) Computing with spatial trajectories. Springer
 Zheng et al (2011) Zheng Y, Zhang L, Ma Z, Xie X, Ma W (2011) Recommending friends and locations based on individual location history. ACM Transactions on the Web 5(1):1–44
 Zheng et al (2014) Zheng Y, Capra L, Wolfson O, Yang H (2014) Urban computing: concepts, methodologies, and applications. ACM Transactions on Intelligent Systems and Technology 5(3):1–55
Appendix: the animal dataset
ind1  ind6 
ind8  ind10 
ind12  ind14 
ind17  ind25 
ind35  ind39 
ind41  ind49 
Comments
There are no comments yet.