Skip to content

Dynamic Time Warping (DTW) to find dynamic lags between 2 time series

Notifications You must be signed in to change notification settings

hashim-vgr/dtw-showing-dynamic-lags

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 

Repository files navigation

DTW-Showing-Dynamic-Lags

About the Project

This is done as part of the Blood Pulse Cycle Cutting project during an academic research internship under the Healthcare Technology Innovation Center (HTIC) at IIT Madras. The team members include Hashim P, Ayisha Jumaila TP, and Ajisha T, under the guidance of Dr. Nabeel PM (Lead Research Scientist, HTIC IITM) and Mr. Raj Kiran V (Project Scientist). We thank them for their guidance and support.

DTW (Dynamic Time Warping) is a method to quantify the similarity between two time series or sequences exhibiting a certain likeness but may vary in speed and amplitude. DTW can be used to calculate the similarities between two time series.

But here We're showing how to use it to calculate the dynamic lags between two time series signals.

What are Dynamic lags?

image
Like the image shown above, dynamic lags give information on wether a current sample is leading of lagging correspoinding to it's counterpart in the other signal.

Detailed Breadown of the Process

step 1: Take 2 signals with same number of samples (s1.txt and s2.txt in the code provided)

image

step 2: Calculate error matrix with a defined search window (given as 100 in the code)

image
image

step 3: Accumulated the errors by an interval of H (value set as 50 in the code)

image
image

step 4: Backtrack through the accumulated indices to get dynamic lags

image
The red arrow shows the way we backtrack

step 5: Interpolate the lag waveform to the same number as our number of samples

image
This wave form means: 1. For positive values of lag waveform, signal 1 is leading in respect to signal 2 2. For negative values of lag waveform, signal 1 is lagging in respect to signal 2

Happy coding...!!!

About

Dynamic Time Warping (DTW) to find dynamic lags between 2 time series

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages