A Novel Method for Fast Change-Point Detection on Simulated Time Series and Electrocardiogram Data

Although Kolmogorov-Smirnov (KS) statistic is a widely used method, some weaknesses exist in investigating abrupt Change Point (CP) problems, e.g. it is time-consuming and invalid sometimes. To detect abrupt change from time series fast, a novel method is proposed based on Haar Wavelet (HW) and KS statistic (HWKS). First, the two Binary Search Trees (BSTs), termed TcA and TcD, are constructed by multi-level HW from a diagnosed time series; the framework of HWKS method is implemented by introducing a modified KS statistic and two search rules based on the two BSTs; and then fast CP detection is implemented by two HWKS-based algorithms. Second, the performance of HWKS is evaluated by simulated time series dataset. The simulations show that HWKS is faster, more sensitive and efficient than KS, HW, and T methods. Last, HWKS is applied to analyze the electrocardiogram (ECG) time series, the experiment results show that the proposed method can find abrupt change from ECG segment with maximal data fluctuation more quickly and efficiently, and it is very helpful to inspect and diagnose the different state of health from a patient's ECG signal.


Introduction
Detecting abrupt change from time series, called CP detection, has attracted considerable attention in the fields of data mining and statistics. CP detection [1,2,3,4,5] has been widely studied in many real-world problems, such as atmospheric and financial analysis [1], intrusion detection in computer networks [2], signal segmentation in data stream [3], as well as fault detection in engineering systems [4,5]. A good method of CP detection is by comparing probability distributions of time series samples over past and present intervals [6,7], in which a typical strategy is to trigger an alarm for a CP as two distributions are becoming significantly different. Various methods of change detection follow this statistical framework, including the CUSUM (cumulative sum) [7], the GLR (generalized likelihood ratio) [8,9] and the change finder [4]. Generally, these approaches are limited by relying on pre-specified parametric models such as probability density models, autoregressive models, and state-space models. Therefore, these methods tend to be less flexible in real-world CP detection problems.
In community of statistics, some non-parametric approaches for CP detection have been explored, in which non-parametric density estimation is used for calculating the likelihood ratio [10,11]. However, this kind of estimation is a hard problem [12,13], and may not be promising in practice. As a nonparametric method, the KS statistic quantifies a distance between the empirical distribution function of the sample and the cumulative distribution function of the reference distribution, or between the empirical distribution functions of two samples [14,15]. Moreover, the KS test is for the equality of continuous, one-dimensional probability distributions that can be used to compare a sample with a reference probability distribution, or to compare two samples. The null distribution of this statistic is calculated under the null hypothesis that the samples are drawn from the same distribution or that the sample is drawn from the reference distribution. The two-sample KS test is one of the most useful and general nonparametric methods for comparing two samples, as it is sensitive to differences in both location and shape of the empirical cumulative distribution functions of the two samples. Recently, non-parametric KS statistic and its modified version are broadly investigated on several of application fields. For example, the use of the KS statistic for testing hypotheses regarding activation in blood oxygenation level-dependent functional MRI data [16]; modeling the cumulative distribution function of rubinduced AE signals and quantifying the goodness of fit with the KS statistic, to offer a suitable signal feature for diagnosis [17]; abrupt change point (CP) detection from electroencephalography signal (EEG) [18], and gene expression time series database [19].
On the other hand, Wavelet Transform (WT) is another promising approach for CP detection. In the past decade, WT approach has emerged as an important mathematical tool for analyzing time series [20,21,22,23,24]. It has found applications in anomaly detection, time series prediction, image processing, and noise reduction [20,24,25,26]. In particular, wavelets can represent general functions at different scales and positions in a versatile and sophisticated manner, so the data distribution features can be easily extracted from different time or space scales [26,27]. The heart of wavelet analysis is Multi-Resolution Analysis (MRA), by which a signal can be decomposed into sub-signals of different size resolution levels [7,27,28]. The properties of wavelets such as localization, orthogonality, multi-rate filtering, are essential for analysis of non-stationary and transient signals. WT can represent a general function in terms of simple, fixed building blocks at different scales and positions. These building blocks are generated from a single fixed function called mother wavelet by translation and dilation operations [29,30]. In addition, Haar Wavelet (HW), as a simpler WT, owns some attracting features including fast for implementation and ability to analyze the local feature. HW is a very useful to find discontinuities and high frequency changes in time series, and a potential candidate in modern electrical and computer engineering applications, such as signal and image compression, as well as abnormality detection from time series [7,28].
However, most of these methods above are time-consuming, and not scalable to large-scale datasets due to their time complexity. Moreover, some of them, e.g., KS, is occasionally insensitive even invalid for less significant data fluctuation, especially when abrupt change occurs near two endpoint areas. To detect abrupt change from time series quickly and efficiently, a novel non-parametric method is proposed based on multi-level HW and a modified KS statistic. In this method, we combine superiorities of both KS statistic and HW methods, and try to find an abrupt change in terms of maximal data fluctuation existing between two adjacent segments of a diagnosed time series. This paper is organized as follows. Section II implements the integrated HWKS method in detail. First, the two BSTs termed TcA and TcD, are constructed by means of multi-level HW from a diagnosed time series. Then, the framework of HWKS method is implemented by introducing a modified KS statistic and two search criteria based on TcA and TcD. Last, two HWKSbased algorithms are designed to implement CP detection from the diagnosed time series. Section III evaluates the performance of HWKS by comparing KS, HW, and T methods, via simulated time series and real ECG datasets. Section IV gives conclusion from previous sections.

Method
The flow diagram of the integrated HWKS framework ( Fig. 1) is composed of three parts. First, the two BSTs, TcA and TcD are constructed from a diagnosed time series. Second, abrupt CP is detected from root to leaf nodes of TcA in terms of a modified KS statistic and two search rules. Last, the performance of HWKS is evaluated by comparing with KS, HW, and T methods.

A. Construction of TcA and TcD
Like all wavelet transforms, multi-level HW decomposes a discrete signal into two sub-signals with half its length. One subsignal is a running average or trend; the other sub-signal is a running difference or fluctuation. HW is performed in several stages or levels [28]. It can be described using scalar products with scaling signals and wavelets. The discrete signals are synthesized by beginning with a very low-resolution signal, successively adding on details to create higher resolution versions, and ending with a complete synthesis of the signal at the finest resolution. Generally, by using k-level HW, a discrete time series signal Z = {z 1 , z 2 ,…, z N }, can be decomposed into the k th -level trend cA k , and k level fluctuations, i.e.,cD 1 , cD 2 ,…, cD k , k = 1, 2, .., log 2 N. As shown in Fig. 2, the k-level HW is the mapping H k defined by [8], The multi-resolution analysis (MRA) is the heart of wavelet analysis [23,29], in terms of MRA, we can conceptualize the process of HW as a projection of time series with size N to total N different vectors v i and w i , termed as scaling signals and wavelet basis vectors, respectively. The discrete signal Z, average and detail signals are expressible as: Thereafter, the following equations can be obtained, A k~c A k : V k cA k,1 ,cA k,2 ,:::,cA k,N=2 k : v k 1 ,v k 2 ,:::,v k N=2 k , (a k 1 ,a k 2 , . . . ,a k N-1 ,a k N ,) ð6Þ D k~c D k : W k cD k,1 ,cD k,2 ,:::,cD k,N=2 k : w k 1 ,w k 2 ,:::,w k N=2 k , where v k i is k-level Haar scaling signals, w k j is k-level Haar wavelets, |v k i | = |w k j | = N. In addition, we can represent HW with k-level approximation and detail coefficient vectors by the following matrices, namely McA and McD: where 0ƒkƒm~log 2 N, 1ƒjƒN=2 k . Suppose the size of a diagnosed sample Z is divisible k times by 2, we can further denote the j th element in cA k and corresponding averaged signal in A k , as well as the j th element in cD k and corresponding detail signal in D k as follows: a k,a~: :: d k,a~: :: where 2ƒkƒlog 2 N, and 2 k (j{1)z1ƒiƒj Ã 2 k ; a~2 k (j{1) z1, c~2 k (j{1)z2 (k{1) , and b~2 k Ã j. Therefore, a diagnosed Z can be decomposed into cA and cD matrices by means of k-level HW. Thereafter, as shown in

B. HWKS method based on a modified KS statistic
KS test is one of the most useful and general non-parametric methods for comparing two samples, because it is sensitive to those differences in both location and shape of the empirical cumulative distribution functions (e.c.d.f) of two samples [31,32]. Suppose Y~fy 1 ,:::,y N g is a time series, we observe, Y~f (i=N)zX , i~1,:::,N, where X~fx i g i~1,::::,N are discrete and centred i.i.d. random variables, and f is a noisy signal with unknown distribution. Thereafter, we can deal X as a normal time series with distribution function F m (x), and Y as an abnormal time series with distribution function G n (x). Then, we can assemble a diagnosed time series Z, and define it as below: To detect an abrupt CP from Z, a modified KS statistic is defined to evaluate the distribution distance between X and Z [15,33,34]: if a change point c occurs in Z, there exists a value z c satisfies As hypothesized F m (x) and G n (x) are not available, but instead, the e.c.d.f of F m (x) and G n (x) can be derived from two time series X and Z. Then, F m (x) and G n (x) are defined by, where F m (x) and G n (x) count the proportion of the sample points below level x. For any fixed point x[R, the law of large numbers implies that where F (x) and G(x) are true underlying distribution of two time series X and Z, i.e. the proportion of the sample in the set ({?,x approximates the probability of this set. It is easy to say that this approximation holds uniformly over all x[R : sup i.e., the largest difference between F m (x) and G n (x) goes to 0 in probability. The key observation in KS test is that the Fast Method for Change-Point Detection PLOS ONE | www.plosone.org distribution of this supremum does not depend on the 'unknown' distribution P in diagnosed Z, if P is continuous distribution. In addition, we have, where H(s) is the c.d.f. of KS distribution [35].
In terms of the definition of non-leaf nodes in TcA in equations (9), we can denote the j th element z j of Z and define a new element z k,j used in HWKS method as, where cA k,j is a non-leaf node of TcA, z k,j is a new element defined in terms of cA k,j , and 1ƒkƒlog 2 N, 1ƒjƒN=2 k ; a~2 k (j{1)z1, and b~2 k Ã j. Then, a revised KS statistic for HWKS is defined as: where D' mn (k,j) measures the distribution distance between X and Z at a selected node cA k,j in TcA, and larger value of D' mn (k,j) means that more significant change occurs in Z. Thereafter, we define a KS test for X and Z as, if null hypothesis is true then, the distribution of D' mn can be tabulated as it depends only on n. Moreover, if n is large enough then the distribution of D' mn is approximated by KS distribution. On the other hand, suppose F m =G n , since F m and G n are the true c.d.f. of X and Z, bylaw of large numbers the e.c.d.f, F m will converge to G n , and for large n we will have, If H 0 fails then, Therefore, to test H 0 we make a detection rule, where c depends on the level of significance a, and can be found by using KS distribution when n is large.
If sup

C. HWKS-based CP Detection
To detect abrupt change from diagnosed Z, an optimal path needs to be obtained from root to leaf nodes in TcA accurately and quickly. Therefore, as shown in Fig. 4, two search criteria are introduced in terms of TcA and TcD. The first search criterion is defined based on TcA as follows: Criterion 1. Suppose the current non-leaf node in TcA we selected is cA k,j , and its left-child and right-child nodes are cA k-1,2j-1 and cA k-1,2j , respectively, wC(a)) hold true, then the left-child node cA k-1,2j-1 is selected to be involved into the current search path in TcA; wC(a)) hold true, then the right-child node cA k-1,2j-1 is selected to be involved into the current search path in TcA.
Proof. In terms of the definitions of z k,j and D' mn in equation (21) and (22), D' mn (k{1,2j{1), and D' mn (k{1,2j) can be written as where z k{1,2j{1 and z k{1,2j are two diagnosed points in accordance with cA k-1,2j-1 and cA k-1,2j in TcA. In terms of Criterion 1, if (D' mn (k{1,2j{1)wD' mn (k{1,2j) holds true, as plotted in Fig. 5, it indicates that more significant distribution distance exists in the left sub-tree covered by cA k-1,2j-1 , than in the right one covered by cA k-1,2j , and vice versa. That is, abrupt CP occurs in the left segment of Z with more probability than in the right one. On the other hand, If D' mn (k{1,2j{1)wC(a)) is satisfied, it means that the distribution distance overtakes a critical value given in an identical data distribution. Criterion 1 guarantees that if abrupt CP occurs in Z, the left or the right sub-tree with bigger distribution distance is selected to be involved into the current search path, and then the other half part Fast Method for Change-Point Detection PLOS ONE | www.plosone.org is discarded. Thereafter, an optimal search path can be detected from root to leaf nodes in TcA after about log 2 (n) search steps. Unfortunately, if (D' mn (k{1,2j{1)~~D' mn (k{1,2j) or (max(D' mn (k{1,2j{1),D' mn (k{1,2j))vC(a)) are true, then Criterion 1 is invalid for CP detection. Therefore, another search criterion is introduced based on TcD, and defined as below.
Criterion 2. Suppose D' mn (k{1,2j{1)~~D' mn (k{1,2j) or (max(D' mn (k{1,2j{1),D' mn (k{1,2j))vC(a)) is satisfied, the non-leaf node cD k,j in TcD is selected, in accordance with the current non-leaf node cA k,j in TcA, with its left-child node cD k{1,2j{1 and right-child node cD k{1,2j , respectively, (a) if cD k{1,2j{1 w cD k{1,2j holds true, then the left-child node cA k-1,2j-1 is selected to be involved into the current search path in TcA; v cD k{1,2j holds true, then the right-child node cA k-1,2j is selected to be involved into the current search path in TcA.
Proof. In accordance with the definition of cD k,j in equation (11), cD k-1,2j-1 and cD k-1,2j can be written by where L 0~2 R 2~2 (k{1) (2j), and m~n~( ffiffi ffi 2 p ) (k{1) . In terms of equation (30), and (31), D L , and D R can reflect data fluctuation of two segments, namely Z L and Z R in Z covered by cD k-1,2j-1 and cD k-1,2j , respectively. None loses of generalization, if cD k{1,2j-1 w cD k{1,2j is true, it means that bigger data fluctuation exists in Z. L than in Z. R . That is, a potential abrupt change exists in Z L covered by cD k-1,2j-1 with more probability than in Z R covered by cD k-1,2j . Therefore, in terms of criterion 2, left-child node cA k-1,2j-1 is selected to be involved into current search path in TcA, and vice versa.
In terms of two search criteria above, two HWKS-based algorithms are implemented to detect abrupt change from a diagnosed time series Z. In Algorithm 2, the distribution distance between X and Z is calculated in terms of a selected non-leaf node cA k,j in TcA. In this function, the confidence interval is set by a~0:05, and C(a)~1:3258. For simplicity, we only output the nodes that the value of D' mn overtakes C(a), otherwise output zero. In Algorithm 3, an optimal path is detected from root to leaf nodes in TcA in terms of two search criteria, and then an estimated CP is obtained from a

D. Evaluation of HWKS
Many methods have been proposed for CP detection. In this part, the following typical methods are used to evaluate and verify the performance of the proposed HWKS method.
KS statistic [15]. In KS method, firstly, we divide a diagnosed sample data Z into two segments, namely, Z m = {z 1 , z 2 ,…, z m }, and z N-m = {z m+1 , z m+2 ,…, z N-m }. Then, KS statistic for these two segments is defined by, where N is the size of the diagnosed sample Z; m is the size of segments Z m , that is the current diagnosed position in Z. HW [28,33]. In this method, the fluctuation coefficient vector cD 1~f cD 1,1 ,cD 1,2 ,:::,cD 1,N=2 ,g is calculated by one-level HW Algorithm.3. Input: X, Z, TcA, and TcD derived from Z. Output: The estimated abrupt CP from TcA and TcD. Set b = 1; N = length (z); k = log 2 (N); Set the first node of optimal search path is the root node in TcA: For i = 1 to k do a = k-i+1; Call Algorithm 2 to calculate the distribution distance between X and Z at two non-leaf node cA a-1,2b-1 and cA a-1,2b-1 , respectively; Set S1 = RS(cA a-1,2b-1 ), S2 = RS(cA a-1,2b ); If (S1.S2) Then {The current selected node = cA a-1,2b-1 ; b = 2b-1;} elseIf ((S1,S2) Then {The current selected node = cA a-1,2b ; b = 2b;} elseIf ((S1 = = S2) Then {If(cD a-1,2b-1 . cD a-1,2b ) Then { The current selected node = cA a-1,2b-1 ; b = 2b-1; } endif If(cD a-1,2b-1 , cD a-1,2b ) Then { The current selected node = cA a-1,2b ; b = 2b; } endif } } Endif End for Output b, and z b from a diagnosed time series Z, and then an estimated CP can be found by comparing the values of elements in vector cD 1 . The elements in cD 1 is defined as, where 1ƒjƒN=2. To find an abrupt change, a critical value d is given in terms of an identical data distribution. If max 1ƒjƒN=2 cD 1,j w ffiffi ffi 2 p : d holds true, then an abrupt CP occurs in a diagnosed sample Z. T-statistic [36]. T, also known as Welch'st-test, is used only when two population variances are assumed different (the two sample sizes may or may not be equal) and hence must be estimated separately. A diagnosed sample Z is divided into Z m = {z 1 , z 2 ,…, z m } and Z N-m = {z m+1 , z m+2 ,…, z N-m }. Then, T statistic is calculated as, where Z Z m , and Z Z N{m are the sample mean of two segments in diagnosed Z, S * is unbiased estimator of standard deviation, and m, n is the size of two segments in Z.

Results and Discussion
First, we evaluate the performance of HWKS on the simulated time series datasets, the sensitivity, efficiency, and accuracy of HWKS is analyzed by comparing KS, HW, and T methods. Then, we apply HWKS, and other three methods, to distinguish normal and abnormal ECG segments from the assembled ECG time series samples, and diagnose the different states of health from a patient's abnormal ECG time series segments.

A. Analysis on simulated time series
In our simulations, the artificial time series are generated randomly in terms of normal distribution N(0,1), i.e., N(mean, u = 0, standard deviation, sd = 1), and then the normally distributed datasets is used for abrupt change detection. Specifically, each diagnosed time series sample of size N is composed of both a normal segment of size k, and an abnormal segment of size N-k, in which a designed abrupt change is contained by adding constant variation v to the normal random numbers of size N-k.
Single simulation on single CP test position. First, CP detection is performed on single time series sample with single CP test position. The simulation results of CP detection are illustrated in Fig. 6, and the summarized analysis of error, and accuracy is shown in Table 1. For the proposed HWKS, it can detect the designed CP from samples of different sizes and CP test positions, with smaller error, and higher accuracy than HW, and T methods. For KS, it has the smallest averaged error in all four methods, but it has lower accuracy than HWKS, especially when sample size N is small. On the contrary, both of HW and T are worse, due to  bigger error and lower accuracy than HWKS and KS. These simulation results indicate that HWKS has the best sensitivity and performance in four methods, especially HWKS is better than KS, due to smaller error and higher accuracy when abrupt change is located near the left or right boundary of samples with smaller size.
Multiple simulations on single CP test position. Second, we test HWKS and other three methods by multiple 600 simulations on single CP test position, with different N, and k. The representative results of CP detection are illustrated in Fig. 7, and the analysis of computation time, hit rate, error, and accuracy is summarized in Table 2. For the proposed HWKS, most of e-CPs are located near the designed CP position, with the shortest computation time, and the highest hit rate in all four methods, as well as smaller error, and higher accuracy than HW and T. For  KS, to some extent, it is better than HWKS and HW for higher accuracy and smaller error; however, it needs much more computation time, and has lower hit rate than HWKS when abrupt change occurs near the left or right boundaries of samples with smaller size N. As for HW, it needs more computation time than HWKS and KS, and has the lowest hit rate and the biggest error in four methods. T is a method with the longest computation time in all four methods, and lower hit rate than HWKS and KS, although it has relatively higher accuracy than HWKS. These simulations show that, the proposed HWKS is a fast and efficient method, due to the shortest computation time and the highest hit rate in all four methods, as well as smaller error and higher accuracy than HW and T. In addition, HWKS has better sensitivity to less significant data fluctuation in sample with small size N, than KS, HW, and T, especially when CP is located near the left or right boundary.   of simulations on single CP with different test positions are shown in Fig. 8, including e-CP, hit rate, error, and accuracy. In addition, the simulation results for different samples of size from 2 3 to 2 10 are summarized in Table 3. In terms of computation time, hit rate, error, and accuracy, the trend analysis for different sample size N, as well as the histogram of the averaged analysis for different methods are plotted in Fig. 9.
For the proposed HWKS, it has the best performance for CP detection from samples Z of size N from 2 3 to 2 7 , because of the shortest computation time, the highest hit rate, the smallest error, and the highest accuracy in all four methods. Meanwhile, HWKS is better than KS, HW, and T methods for samples Z of size N from 2 8 to 2 10 , due to the shortest computation time, the smallest error, and the highest accuracy in all four methods, except that hit rate is slightly lower than KS and T. For KS, in general, it has shorter computation time, bigger hit rate, smaller error and higher accuracy than HW. However, KS has the lowest hit rate, the biggest error, and the lowest accuracy as N is below 2 5 in all four methods, which means that KS has worse sensitivity and performance for less significant data fluctuation, especially when N is smaller. For HW, it generally takes shorter computation time than T, whereas, it has the smallest hit rate, the biggest error and lowest accuracy in all four methods. For T, it takes the longest computation time, although bigger hit rate, smaller error and higher accuracy than KS and T. These results show that HWKS has better performance and sensitivity to less significant data fluctuation near the left and right boundary of samples with smaller size N and HWKS is an encouraging method for CP detection on simulated time series, due to shorter computation time, higher hit rate, smaller error, and higher accuracy than KS, HW, and T methods.

B. Analysis on ECG time series
To verify the performance of the proposed method further, we apply HWKS, and KS, HW, and T methods, to detect abrupt change from ECG time series provided by PhysioBank. In ECG experiments, we design the diagnosed ECG samples from different ECG datasets, including the MIT-BIH Normal Sinus Rhythm Database (NSRDB) [37], MIT-BIH Noise Stress Test Database (NSTDB) [38], and MIT-BIH Malignant Ventricular Arrhythmia Database (MVADB) [39,40].
CP detection from assembled ECG samples. First, we select a normal ECG dataset, 16265m from the NSRDB, and an abnormal ECG dataset, 118e00m from the NSTDB, and then assemble the diagnosed ECG samples from different segments in the 16265m and 118e00m. Specifically, we take the normal ECG segment of size m as X m , and the abnormal segment of size n as Y n , respectively, and then assemble the diagnosed ECG sample Z = {X m , Y n } = {x 1 ,…, x m , y 1 ,…, y n }. Meanwhile, we design another normal ECG segment from 16265m, i.e., X = {x 1 ,…, x m+n }, as normal time series input.
In this ECG experiment, a single CP test position is arranged near the left and right boundary of the assembled ECG sample. For the assembled ECG sample of size from N = 2 9 to 2 14 with different CP position k, the results of CP detection from Z1-Z6 are illustrated in Fig. 10, and then the analysis of computation time, error, and accuracy are summarized in Table 4. Comparing with KS, HW, and T methods, the results show that the proposed HWKS can estimate CP position more quickly, and distinguish the normal and abnormal segments from the assembled ECG samples more efficiently, with smaller error and higher accuracy. For KS, it has smaller error and higher accuracy than HW and T, whereas, it takes much more computation time than HWKS, HW, and T, especially when sample size N gets bigger, meanwhile, KS is less sensitive for less significant statistic fluctuation, with bigger error near the right boundary. For HW, it is inefficient, because of the biggest error and lowest accuracy in all four methods. For T, it is also discouraging for longer computation time, bigger error and lower accuracy than HWKS and KS. Therefore, the proposed HWKS has the best performance in this ECG experiment out of all four methods.
CP detection from abnormal ECG samples. To verify the performance of CP detection further, we apply the proposed HWKS, and KS, HW and T to analyze the abnormal ECG time series directly. In this part, we select the abnormal ECG segment from 118e00m in the NSTDB, i.e., Z = {y 1 ,…, y n }, as a diagnosed ECG sample. Then, we take another normal ECG segment from 16265m in the NSRDB, i.e., Z = {X n } = {x 1 ,…, x n }, as normal input signal. To some extent, the distance of e.c.d.f can partly reflect the statistical fluctuation. Therefore, we take this variable as an indicator of the data fluctuation between two ECG segments divided by e-CP position. The results of CP detection, including the e-CP position, distance of e.c.d.f, and computation time, are plotted in Fig. 11, and summarized in Table 5.
For abnormal ECG samples Z1-Z6 with different size N from 2 10 to 2 15 , HWKS can detect abrupt change position, and then divide the original ECG sample into two parts, with the shortest computation time out of four methods, and bigger distance of e.c.d.f than HW and T methods. For KS, it can detect CP with the maximal distance of e.c.d.f; however, it needs longer computation time than HWKS, HW and T, especially for ECG sample with big size N. On the other hand, for HW, it is inefficient, due to smaller distance of e.c.d.f than HWKS and KS. T is also inefficient, because of longer computation time than HWKS, HW, the smallest distance of e.c.d.f, and the invalid e-CP position for most of the abnormal ECG samples.
Especially, the results of CP detection from Z1-Z3 plausibly indicate that, a patient seems recovering from abnormal state of health, after overtaking the critical e-CP position detected by HWKS. On the contrary, the results from Z4-Z6 suggest that, a patient is encountering a risky situation from the former state of health, after going through the vital e-CP position. These results indicate that HWKS can capture abrupt change position from a diagnosed ECG sample quickly and efficiently, and the detected CP is very useful to find a critical time from ECG time series, where a patient might encounter an important conversion between two different states of health. Therefore, HWKS is an efficient and encouraging method for detecting abrupt change from abnormal ECG time series, and it is very meaningful in inspecting and diagnosing different states of health from diagnosed ECG time series more quickly and efficiently.

Conclusion
In this paper, based on HW and a modified KS statistic, a novel HWKS method is proposed for CP detection from large-scale time series. First, two BSTs are constructed from a diagnosed time series by means of multi-level HW method, the framework of HWKS method is implemented by introducing a revised KS statistic and two search criteria based on TcA and TcD; and then two HWKS-based algorithms are designed to detect an optimal path from TcA in terms of two search criteria. Second, the performance of HWKS is analyzed on simulated time series; the simulations show that HWKS is more sensitive and efficient than KS, HW, and T methods, especially when CP occurs near the left or right boundary with less significant data fluctuation in time series of small size. Last, HWKS is applied to analyze abrupt change on both assembled and abnormal ECG datasets. The results indicate that HWKS can successfully detect abrupt change, and distinguish normal and abnormal ECG segments from assembled ECG samples. In addition, HWKS can estimate an abrupt CP from abnormal ECG segments with different timescale, and then divide it into two adjacent parts with maximal data fluctuation; therefore, it is very useful to diagnose a patient's different states of health from an abnormal ECG segment more quickly and efficiently. In conclusion, HWKS is a novel and efficient method for fast CP detection; it is a very powerful and promising tool to find useful information from large-scale time series databases.