Skip to main content
. 2019 Nov 27;19(23):5192. doi: 10.3390/s19235192
Algorithm 2 DTW-based subsequence search algorithm
Input reference pattern X=(x1,,xN), a longer data stream Y=(y1,,yM), with MN, and a threshold τ
Output a list L of repetitions of X within Y having, individually, a DTW lower than τ. The list is ranked depending on the individual DTW
  • 1:

    L=

  • 2:

    compute the accumulated cost matrix D between X and Y

  • 3:

    compute the distance function Δ

  • 4:

    find b*=arg minb{1,,M}Δ(b)

  • 5:

    IfΔ(b)>τthen STOP

  • 6:

    find a* by using Optimal warping path algorithm but initialized in j=b instead of j=M

  • 7:

    updating L as: L=LYa*:b*

  • 8:

    Set Δ(b)= for every b in a suitable neighborhood of b*

  • 9:

    GO TO STEP 3