The Dynamic Time Warping (DTW)[1,2] is a time-normalisation algorithm initially designed to eliminate timing differences between two speech patterns. This normalisation, or correction, is done by warping the time axis of one time series to match the other. The correction (time warping) makes it easier to compare two signals in a similar way to the method human beings use[3].
Example of 2D trajectory-matching generated by the DTW method. Although looking perfect in the figure on the left, the cardioid was modified to have a constant value zone from time step $50$ to $150$. The DTW correctly matches the values as can be seen as a straight blue line in the Accumulated Distance plot (right).
Above is presented an example where a cardioid is compared to a circle. The cardioid also had a time delay inserted (values were kept constant). The DTW calculates the distance (here the Euclidean one) between all the points of the two time series and, then, generates another matrix with the accumulated distances. The total distance defined by the path formed with the minimum values of the accumulated distance (right-hand side of the figure) can be easily applied to compare different shapes.
This version of the algorithm uses a C kernel, supporting multidimensional arrays and Euclidean distance, to speed up the calculations with a Python wrapper as the user interface. More details and sample code can be found in this Jupyter notebook:
if you are not happy with my explanations above, one of the best explanations about how the DTW works I've found on a presentation by Elena Tsiporkova.
- Clone the repository, or download it as a zip file and unzip it.
- Inside the directory
dtw_python
executemake
. - Now, to install the library and make it accessible to all users you need to execute
sudo make install
. - After that you don't need the
dtw_python
directory anymore and you can test it using the jupyter notebook.
- Graceful Degradation under Noise on Brain Inspired Robot Controllers
- Diverse, Noisy and Parallel: a New Spiking Neural Network Approach for Humanoid Robot Control
- Short-Term Plasticity in a Liquid State Machine Biomimetic Robot Arm Controller
- Neurorobotic Simulations on the Degradation of Multiple Column Liquid State Machines
- Sensor Fusion Approach Using Liquid StateMachines for Positioning Control
- Sakoe, H., and S. Chiba. “Dynamic Programming Algorithm Optimization for Spoken Word Recognition.” IEEE Transactions on Acoustics, Speech and Signal Processing 26, no. 1 (February 1978): 43–49.
- Meinard Müller. “Dynamic Time Warping.” In Information Retrieval for Music and Motion, ch. 4, 69-82. New York: Springer-Verlag, 2007.
- Ratcliff, Roger. “Continuous versus Discrete Information Processing: Modeling Accumulation of Partial Information.” Master Thesis, Radboud University Nijmegen, 2004.
- colab_utils: Some useful (or not so much) Python stuff for Google Colab notebooks
- ExecThatCell: (Re)Execute a Jupyter (colab) notebook cell programmatically by searching for its label.
- Maple-Syrup-Pi-Camera: Low power('ish) AIoT smart camera (3D printed) based on the Raspberry Pi Zero W and Google Coral EdgeTPU
- The CogniFly Project: Open-source autonomous flying robots robust to collisions and smart enough to do something interesting!
- Bee: The Bee simulator is an open source Spiking Neural Network (SNN) simulator, freely available, specialised in Liquid State Machine (LSM) systems with its core functions fully implemented in C.