As in Chapter 1 the problem of similarity inconsistency is introduced. Similarity inconsistency results in a difficult situation that for time series subsequences with different lengths, it is impossible to decide whether any two subsequences are similar or not with a given threshold. In the case we show in figure 1.3, if we set the threshold of similarity to be 3 under Euclidean distance or 2 under DTW distance, traditional method will not be able to find longer patterns such as the 128 data points pair. On contrary, the threshold could be too large for shorter time series such as the 32 data points ones. In this situation, long similar
0 5 10 15 0 2 4 6 8 10 12 (a) 2 4 6 8 10 12 14 5 10 2 4 6 8 10 12 14 0 5 20 40 60 80 100 (b) 0 5 10 15 0 2 4 6 8 10 12 (c) 2 4 6 8 10 12 14 5 10 2 4 6 8 10 12 14 0 5 20 40 60 80 100 (d)
Figure 3.1: Illustration of DTW distance. Figure a shows how data points in one time series are measured with diffent datapoints of another time series under DTW distance. Figure bshows cost matrix and warping path of DTW distance. Figurec anddillustrate the situation when Sakoe-Chiba constraint
withwidth= 2 (coloured area in figured) is applied.
patterns are ignored and short dissimilar time series are picked up as patterns. We take Euclidean distance to explain the problem.
3.3.1
Similarity Inconsistency in Original Space
Let us begin with the simplest example. Assume we have all the subsequences with 2 data points asT S1 andT S2 in figure 3.2a. We plot these time series in points in a 2 dimension rectangular coordinate system in figure 3.2b as they all have only two data points. As the definition of Euclidean distance, Euclidean distance between time seriesT S1 andT S2 in figure 3.2a is the length between
the two points T S1 andT S2 in figure 3.2b. Then we extend time series T S1 andT S2 with one more data point as in figure 3.2c. Similarly, the Euclidean distance betweenT S10 andT S20 is the length between pointsT S10 andT S20 in figure 3.2d. Note that the projection of pointsT S10 andT S20 in figure 3.2d on X−Y plane is T S1 andT S2 in original space as in figure 3.2b. Thus, as we add a dimension forT S1 andT S2, the length fromT S10 toT S20 in figure 3.2d must be no less than the length fromT S1 toT S2 in figure 3.2b, since in figure 3.2d line segmentT S1−T S2 constructs the cathetus and line segment
T S10−T S20 constructs the hypotenuse. Though for both time series pairs in figure 3.2a and figure3.2c, we can liftT S1 andT S10 by 0.2 to make them the same time series asT S2 andT S20 respectively, the similarity under Euclidean distance measure of the two pairs changes when the length of time series grow.
(a) 2 Data Points Time Series (b) 2 Data Points Time Series in Original Space
(c) 3 Data Points Time Series (d) 3 Data Points Time Series in Original Space
Figure 3.2: Demonstration of similarity inconsistency
We can develop the simplest case to longer time series pairs in a higher dimensional space and derive the same result, that is for any two pairs of time
series with different time series in each pair, if they have the same similarity visually, the longer pair will always have larger Euclidean distance. Further more, we can confidently deduce that for any distance measure, if the measurement is carried out on spaces with different dimensions for different time series, the distance measure can not guarantee similarity consistency. This conclusion reveals that for discovering arbitrary length of similar patterns in time series data, it is necessary to make the distance measure being applied on a fixed dimensional space.
3.3.2
Consistent Similarity Measure
As illustrated above, the increase of dimensions is the reason of similarity incon- sistency. An intuitive method to produce consistent similarity is to interpolate time series to a dimensional space with fixed number of dimensions. Chapter 4 adopted this method. In that chapter, we interpolate time series subsequences to a 5-dimensional space to achieve consistent similarity measure. Details can be found in Chapter 4.
Another simple but effective method is to average result distance values to eliminate the effect of dimension increase. This method maintains features of original distance measure and is wide applicable. We present the method as follows:
dconsistent(T1, T2) =
r Pn
i=1(xi−yi)2
n (3.3)
In the above equation, the terms are averaged to eliminate the effect of distance accumulation. Similarly for the DTW distance, the number of terms is the length of warping path. The similarity consistent DTW distance can be calculated by:
DT Wconsistent(T1, T2) =
r Pn
k=1wk
K (3.4)
Table 3.1: Distance of figure 1.3 case under our proposed consistent distance measure
Series Length 128 64 32
Consistent Euclidean Distance 0.37 0.35 0.33
Consistent DTW 0.14 0.14 0.18
Both methods average original distance value with the number of alignments. For Euclidean distance the number of alignments is the length of time series being measured, and for DTW distance the number is the length of warping path. The effectiveness of the two similarity consistent distance measurements can be validated using the case study shown in figure 1.3. Table 3.1 shows the distance values of the 3 pairs of motifs shown in figure 1.3 under our proposed distance measure. It is clear that our similarity consistent distance measure is length-invariant.