# 100 Days Of ML Code — Day 049

### Recap From Day 048

In day 048, we saw that the first algorithm we’ll discuss in the coming days, dynamic time warping, allows us to work a bit more easily with actions that unfold over time. It doesn’t rely on us providing excellent segmentation information and it can gracefully handle changes in speed.

Today, we’ll start looking at that first algorithm(dynamic time warping).

### Working with time

#### Dynamic Time Warping

“Dynamic time warping(DTW) is one of the algorithms for measuring similarity between two temporal sequences, which may vary in speed. For instance, similarities in walking could be detected using DTW, even if one person was walking faster than the other, or if there were accelerations and decelerations during the course of an observation.” — Wikipedia

Dynamic time warping is a method that can be used to compute the similarity between two sequence of data over time. For instance, we might compare the sequence of data that is generated as we move the Wiimote below through the air to a sequence that we previously recorded.

In dynamic time warping we’ll return to our usual assumption that each feature vector represents a single snapshot in time. We’ll have the usual constraint that each feature vector has to have the same number and type of features.

For instance, if we’re using the Wiimote above our feature vector will consist of pitch, roll and yaw accelerometer values. However, our sequences of features don’t have to be the same length.

Dynamic time warping allows us to compute the similarity between a very short motion and a very long motion. DTW has been applied to temporal sequences of video, audio, and graphics data — indeed, any data that can be turned into a linear sequence can be analyzed with DTW.

A well known application of dynamic time warping has been automatic speech recognition, to cope with different speaking speeds. Other applications include speaker recognition and online signature recognition. Also it is seen that it can be used in partial shape matching application.

In general, DTW is a method that calculates an optimal match between two given sequences (e.g. time series) with certain restriction and rules. Going forward, we’ll look at what we can do when we have a good measure of similarity between one sequence and another.

It’s awesome to know that you made it to the end of day 049. I hope you found this informative. Thank you for taking time out of your schedule and allowing me to be your guide on this journey. And until next time, be legendary.

*Reference*