An intuitive approach to DTW — Dynamic Time Warping

An intuitive approach to DTW — Dynamic Time Warping

How to visualize the algorithm, so that you can customize it on your own.Since you are here, I assume you already know the reason why we use Dynamic Time Warping, or DTW in time-series data. Simply put, it’s used to align or match two similar patterns. One of the reasons DTW was initially developed was for speech recognition. Your mother may speak slowly one day, and hurriedly on another; even have a bit of cold and sore throat on some days, but you still can recognize her voice. Can machines do the same? Can they somehow match the highs and lows, the peaks and troughs, the frequencies of her voice, no manner how she speaks and tell us it is her voice indeed?

Since you are here, I assume you already know the reason why we use Dynamic Time Warping, or DTW in time-series data. Simply put, it’s used to align or match two similar patterns.

A brief overview

One of the reasons DTW was initially developed was for speech recognition. Your mother may speak slowly one day, and hurriedly on another; even have a bit of cold and sore throat on some days, but you still can recognize her voice. Can machines do the same? Can they somehow match the highs and lows, the peaks and troughs, the frequencies of her voice, no manner how she speaks and tell us it is her voice indeed?

There are several awesome real life situations were DTW just rocks — if you do not know them already, I recommend getting to know them — they are really fun!

You can read more about DTW [here_](https://en.wikipedia.org/wiki/Dynamic_time_warping) and about it’s many applications [here_](http://seninp.github.io/assets/pubs/senin_dtw_litreview_2008.pdf)_ (refer the Introduction section)_

Two signals being aligned

Two signals being aligned — “Image by author”

Take me there, quick!

I

love this algorithm! In essence, it is one of those short and elegant algos which pack a punch. It is a classic example of finding the shortest path using the Dynamic Programming approach.

I have had colleagues running away from understanding the inner workings of the algo as it involves recursion_. _This eventually stops them from understanding the nuances of the approach and from learning how to tweak it as per their requirements.

Let’s visualize the logic behind the algorithm in a non-programmatic way so that we can write it from scratch.

dynamic-programming time-series-analysis recursion dynamic-time-warping dtw

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

What is Time Series Forecasting?

In this article, we will be discussing an algorithm that helps us analyze past trends and lets us focus on what is to unfold next so this algorithm is time series forecasting. In this analysis, you have one variable -TIME. A time series is a set of observations taken at a specified time usually equal in intervals. It is used to predict future value based on previously observed data points.

A Real-World Time Series Data Analysis and Forecasting

Applying the ARIMA model to forecast time series dataThe notion of stationarity of a series is important for applying statistical forecasting models since.

Time Series Analysis of violence in Rio de Janeiro

How the number of civilian deaths by police officers impacts violent crime rates in the state. The death of George Floyd in the United States made a strong mark in the fight for human rights.

Preparing data for time series analysis

TS may look like a simple data object and easy to deal with, but the reality is that for someone new it can be a daunting task just to prepare the dataset before the actual fun stuff can begin.

Simple Multivariate Time-Series Forecasting

This tutorial was supposed to be published last week. Except I couldn’t get a working (and decent) model ready in time to write an article about it.