0
$\begingroup$

I have these 2 sequences:

s1 = [1, 2, 3, 5, 5, 5, 6]
s2 = [1, 1, 2, 2, 3, 5]

And have calculated the DTW matrix as:

+------+------+------+------+------+------+------+------+
|      |   0  |   1  |   1  |   2  |   2  |   3  |   5  |
+------+------+------+------+------+------+------+------+
|   0  |   0  |  inf |  inf |  inf |  inf |  inf |  inf |
+------+------+------+------+------+------+------+------+
|   1  |  inf |   0  |   0  |   1  |   2  |   4  |   8  |
+------+------+------+------+------+------+------+------+
|   2  |  inf |   1  |   1  |   0  |   0  |   1  |   4  |
+------+------+------+------+------+------+------+------+
|   3  |  inf |   3  |   3  |   1  |   1  |   0  |   2  |
+------+------+------+------+------+------+------+------+
|   5  |  inf |   7  |   7  |   4  |   4  |   2  |   0  |
+------+------+------+------+------+------+------+------+
|   5  |  inf |  11  |  11  |   7  |   7  |   4  |   0  |
+------+------+------+------+------+------+------+------+
|   5  |  inf |  15  |  15  |  10  |  10  |   6  |   0  |
+------+------+------+------+------+------+------+------+
|   6  |  inf |  20  |  20  |  14  |  14  |   9  |   1  |
+------+------+------+------+------+------+------+------+

Now I need to generate the warped sequences, but I couldn't find how to do this.

I know this is the path:

enter image description here

And that

  • A horizontal move represents deletion
  • A vertical move represents insertion
  • A diagonal move represents match

What how do I get the warped sequences?

The matrix and sequences where taken from here since I don't want to publish the ones I'm using.

$\endgroup$
1
+50
$\begingroup$

Just follow the instructions:

  • A horizontal move represents deletion
  • A vertical move represents insertion
  • A diagonal move represents match

'deletion', 'insertion' and 'match' refer to the deletion of the period of observation, insertion of another period with the same observation ('elongating the observation') and keeping the period observation without changes.

The warped version of the shorter sequence $[1, 1, 2, 2, 3, 5]$ thus will be

$$[1, \color{red}{1}, 2, \color{red}{2}, 3, 5, \color{green}{5}, \color{green}{5}, \color{green}{5}] = [1, 2, 3, 5, 5, 5, 5]$$

where the deleted observations are colored in red and inserted are colored in green.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.