# Dynamic Time Warping for irregular time series

I have been reading a lot about Dynamic Time Warping (DTW) lately. I am very surprised that there is no literature at all on the application of DTW to irregular time series, or at least I could not find it.

Could anybody give me a reference to something related to that issue, or maybe even an implementation of it?

## 4 Answers

As far as I understand, by irregular time series you mean unevenly spaced time series, also referred to as irregularly sampled time series. Since I am curious about time series in general, I have performed a brief research on the topic of your (and now mine) interest. The results follow.

Despite high popularity of dynamic time warping (DTW) approach in time series analysis, clustering and classification, irregular time series present some challenges to direct application of DTW to such data type (for example, see this paper and this paper). Based on my relatively brief research efforts, it is not totally clear to me, whether it is impossible to apply DTW directly, as some research suggests otherwise (also see this paper/chapter). For more comprehensiveness, I also would like to mention an IMHO excellent and relevant to the topic dissertation on irregular time series.

Nevertheless, it seems that this topic is mostly covered by the following two research streams:

• proposing and evaluating approaches, alternative to DTW, such as model-based ones (see this paper and this paper);
• proposing and evaluating modified DTW approaches, such as cDTW, EDR, ERP, TWED, envelope transforms, CDTW (continuous DTW - do not confuse with cDTW - constrained DTW!) and others variants (for example, see this paper). An overview of the above-mentioned approaches and results of some empirical comparisons can be found in this paper.

Finally, I would like to touch on the subject of open source software, available for research or system implementation, focused on DTW and supporting some of the above-mentioned algorithms for irregular time series. Such software include Python/NumPy-based cDTW module project as well as GPU-focused CUDA-based CUDA-DTW project. For R enthusiasts, a comprehensive Dynamic Time Warp project also should be mentioned (corresponding package dtw is available on CRAN). Even though it might not support many DTW algorithms for irregular time series at the moment (though I think it supports cDTW), I think it is just a matter of time until this project will offer more comprehensive support for DTW algorithms, focused on such type of data. I hope that you have enjoyed reading my answer as much as I have enjoyed researching the topic and writing this post.

I have successfully implemented DTW in 'C' as applied to dynamic signature verification. I used a test data base of Chinese and Dutch signatures to verify EER and got very impressive results. It is currently implemented as a demo on an iPad. My algorithm was hand-coded from several published descriptions. I will share the code if there is a way to get it to you. One thing that also contributed to success was 'normalizing' the input data. This made it a lot easier when comparing disparate data using different sample rates.

• Welcome to our site! Note that your username, identicon, & a link to your user page are automatically added to every post you make, so there is no need to sign your posts. – Silverfish Aug 5 '16 at 23:20
• We like our answers to be useful to future readers rather than just the original poster personally, so the possibility of sharing the code would be more useful if you were able to upload somewhere and share a link here. But if that isn't possible, perhaps you could shed some light on "My algorithm was hand-coded from several published descriptions" - could you cite the ones you used in case someone else wants to follow in your footsteps and implement them? – Silverfish Aug 5 '16 at 23:22

I am only just getting into DTW myself and have not personally used the packages referred to below, but I hope the following may help you.

The Cran.R Project, in particular: • "ts" is the basic class for regularly spaced time series using numeric time stamps. • The "zoo" package provides infrastructure for regularly AND IRREGULARLY spaced time series using arbitrary classes for the time stamps. It is designed to be as consistent as possible with "ts". • zoo: S3 Infrastructure for Regular and Irregular Time Series (Z's ordered observations)

Best wishes.

• My question was about the adaptation of DTW as a method to the context of irregular time series. Packages like Zoo do not provide a solution to that problem. – Remi D Aug 13 '14 at 12:40

TSdist has a function that determines the distance through dtw. It accepts irregular zoo time series

• "Accepts" doesn't mean it handles them. You should always check the source code of a function. – Remi D Aug 13 '14 at 12:38