Change Point Detection Methods
Lựa chọn methods cho change points time series
1 Change-Point-Detection¶
Source fraunhofer blog
Sự lựa chọn kernel và model trong ruptures package
Change in variance, sử dụng ruptures cost function Normal
1.1 Change point detection: Different types of change points ¶
Change point detection has a number of various applications. It is used, for example, in the fields of medicine, aerospace, finance, business, meteorology, and entertainment. Usually, change points are described in terms of changes between segments. To put it simple, a change point divides a time series into two segments where each segment has its own statistical characteristics (e.g., mean, variance, etc.). Thus, the change point is located where the underlying characteristics change abruptly. An overview of the most common change points and approaches for detecting them can be found in (Aminikhanghahi and Cook 2017; Truong et al. 2020). A theoretical description of change point detection, including the mathematical background, can be found in (Basseville and Nikiforov 1993). In the following, we will present some important examples of change points.
Change in mean is the most common example and probably also the easiest to identify (at least visually). Change in mean usually occurs when a time series can be divided into different constant segments having different mean values. One of the earliest algorithms for detecting such changes is the Cumsum algorithm (Page 1954), which was developed to detect change in mean. It was applied for quality control in manufacturing.
Example of change point (change in mean)
Change in variance is another famous example. Here, the mean value of the signal stays constant, but there are several segments with different variance values. This can be interpreted as a sudden noise in the signal. Both change in mean and change in variance can be detected by comparing statistical properties through the signal.
Example of change point detection (change in variance)
Change in periodicity (also called change in frequency) concerns time series with cyclic properties (e.g., a machine’s regime). Here, the change occurs when the frequency changes suddenly. Detection of this kind of change is usually done in the frequency domain, for example by using Fourier transform or wavelet transform.
Example of change point detection (change in frequency)
Change in pattern is more difficult to tackle than the previous ones. Such changes can occur, for example, in ECG signals. Ond one way to detect them is to use Wasserstein distances between empirical distributions (Shvetsov et al. 2020). At this point, we can see that change point detection is closely related to anomaly detection; the difference between the two tasks is sometimes fuzzy.
Example of change point (change in pattern)
Changes in multidimensional time series can become very challenging to detect visually. The following example illustrates a change in the correlation between two dimensions of a time series.
Example of change point detection by change in 2-dimensional Gaussian distribution
There are many other types of change points, depending on the underlying structure of the signal. Usually, the more complex the signal, the more difficult it is to detect the change point.
1.2 Detecting change points ¶
There are countless ways and methods for detecting change points that have been developed during the last decades. An overview of the most common approaches can be found in (Aminikhanghahi and Cook 2017). Several packages for detecting change points have been implemented in R and Python. Usually, most packages provide a lot of hyperparameters that can be adjusted to optimize change point detection or even optimize runtime. However, many packages are not standardized: Some only calculate the costs but not the actual change points, while other packages are not maintained regularly.
Well-known, established, and regularly maintained examples of packages are:
- In R, the following packages are dedicated to change point detection: changepoint, kcpRS, or bcp.
- In Python, the ruptures packages are completely dedicated to change point detection. Other packages such as prophet, luminaire, and scikit-multiflow include – among other features – change point or drift detection.
A common way to conduct change point detection is a sliding window through the signal. The main idea is to walk through the signal with a window of fixed size. For each step, a function computes a chance of having a change point in the current window. This function is usually called the cost function. Thus, for each point in the signal, we obtain a cost value indicating whether there is a change at that point or not. Usually, the costs are “low” as long as there is no change in the window and “high” if there is a change in the window. For example, if the costs exceed a pre-defined threshold, the point is marked as a change point, or the points with the highest costs can be marked as change points.
To detect changes in mean, a simple approach is to use the standard deviation as a cost function. As long as the signal is constant (with some noise), the standard deviation is low. If there is a jump in the signal, the standard deviation will rise. The animation below shows an example of calculating the costs of a change in mean using the standard deviation.
Animation of change point detection via sliding window
The window-based approach can have different extensions. For example, there can be two windows, a past one and a future one. Then the change point can be detected by comparing the costs of these two windows. This idea was also used for the the generalized log-likelihood ratio test (Basseville and Nikiforov 1993). The example below illustrates this approach.
Animation of change point detection via past window and future window
1.3 How to choose an appropriate method for change point detection¶
The theory of change point detection is well established in the literature; several methods have been implemented in standard packages. The question of how to choose the right one is crucial and depends on many factors. As there are many approaches and methods, we present three important factors to make a reasonable decision.
First, you need to know your signal and which type of change you have. Obviously, not every software package can deal with every kind of change. For example, the bcp package in R was developed for sequencing DNA series using a Bayesian approach. But this package cannot be applied to detect changes in mean for normally distributed random variables because it will deliver too many false positives.
Second, the runtime plays an important role. Depending on the application, sensors may deliver hundreds of points in one second. The window-based methods presented above have a runtime of O__(T), where T denotes the length of the signal. That is the reason why most of these types of algorithms can be used in online applications. As more and more data is produced in the context of IoT, much research has been done in the field of online change point detection in the last few years; see, for example, (Namoano et al. 2019). However, such window-based algorithms are usually approximations and therefore often deliver too many change points, which leads to the next factor.
Third, some applications require accurate results. There are other approaches that need a longer runtime but deliver more precise change points. Famous methods are, for example, the binary segmentation or bottom-up approaches, which take O__(T log(T)) time, but they are still approximations. Exact methods take at least O(T²__), some even O(T³) time. At this point, it should be mentioned that some methods are very advantageous if one knows how many change points are present in the signal because they stop with an optimized solution. But for many applications with continuous sensor data, this is not realistic.
In our next series, we will deal with other exciting topics regarding time series analysis. There are many other tasks (for example, classification, clustering, blind source separation) that are also highly relevant in applications. We will also present ideas on how to tackle these tasks. Stay tuned!
Backlinks¶
No other pages link to this page.
Created : Sep 19, 2023
Recent Posts
- 2024-11-02: 🔐BUỔI 10 - Phân tích thị trường
- 2024-11-02: 🔐BUỔI 11 - Phân tích thị trường
- 2024-11-02: 🔐BUỔI 12 - Phân tích sóng tăng
- 2024-11-02: 🔐BUỔI 13 - Phân tích hỏi đáp
- 2024-11-02: 🔐BUỔI 14 - Yếu tố kiểm soát
- 2024-11-02: 🔐BUỔI 15 - Hỏi đáp
- 2024-11-01: 🔐BUỔI 6 - Ôn lại và bổ sung
- 2024-11-01: 🔐BUỔI 7 - Chiến thuật Trend
- 2024-11-01: 🔐BUỔI 8 - Công thức điểm vào lệnh
- 2024-11-01: 🔐K2023 - BUỔI 9 - Quy trình vào lệnh