Time series mining-Introduction to the DTW acceleration algorithm fastdtw

Source: Internet
Author: User

The address of this article is http://www.cnblogs.com/kemaswill/. the contact person is kemaswill@163.com.

About DTWAlgorithmFor more information, see my previous blog: Time series mining-principles and implementation of the Dynamic Time normalization algorithm.

DTW uses dynamic planning to calculate the similarity between two time series. The algorithm complexity is O (n2 ). When the two time series are relatively long, the DTW algorithm is slow and cannot meet the requirements. Therefore, there are many DTW acceleration algorithms: fastdtw, sparsedtw, lb_keogh, lb_improved, and so on. Here we will introduce fastdtw.

1. Standard DTW algorithm

In DTW, we are looking for an integrated path (for details, see the principles and implementation of the time series mining-Dynamic Time collection algorithm), as shown in:

In the end, we want to get the distance (for example, Euclidean distance) between the points XI and YJ of the X and Y time series corresponding to the coordinates of all vertices (I, j) passing through this path) we need to obtain the element d (I, j) in the upper-right corner of the cost matrix ). Based on the idea of dynamic planning:

Requirements d (I, j) must know D (I-1, J), D (I-1, J-1), D (I, J-1), and so on, we need to obtain the entire d matrix to obtain the final d (I, j), that is, the time complexity of the algorithm is O (n2 ).

2. DTW common acceleration Methods

Common DTW acceleration methods include:

(1). Restrictions. That is, to reduce the search space of D, the shadow part is the actual exploration space, and the blank part is not explored.

(2). Data abstraction. That is to say, the time sequence with the previous length of N is reduced to M (M <n:

(3). index. Indexes reduce the number of dtws to be run during classification and clustering, and cannot accelerate one DTW calculation.

3. fastdtw

Fastdtw uses both restrictions and data abstraction to accelerate DTW computing. There are three steps:

(1 ).Coarse granularity. That is, data abstraction is performed on the original time series. Data abstraction can be iterated for multiple times 1/1-> 1/2-> 1/4-> 1/16, coarse-grained data points are the average values of multiple fine-grained data points.

(2 ).Projection. Run the DTW algorithm on the time series at a coarse granularity.

(3 ).Fine-grained. The squares of the normalized Path obtained at a coarse granularity are further refined to a finer granularity of time series. In addition to fine-grained, we also expand K granularities in a finer-grained space (horizontal, vertical, and oblique). k isRadius Parameter, Usually 1 or 2.

The specific execution process of the fastdtw algorithm is shown in:

The first figure indicates that the DTW algorithm is executed within a coarse-grained space (1/8. The second figure shows how to fine-grained the squares of the normalized Path obtained in a coarse-grained space (1/8) and expand one (determined by the radius parameter) outward (horizontal, vertical, and oblique) after the unit is fine-grained, run the DTW command to return the path. This is also true for the third and fourth figures.

Because of the strategy of reducing the search space, fastdtw does not necessarily obtain an accurate DTW distance, but the time complexity of fastdtw is relatively low, which is O (n ).

References:

[1].Fastdtw: toward accurate dynamic time warping in linear time and space.Stan Salvador, Philip Chan.

[2]. Wikipedia: Dynamic Time Warping

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.