Skip to main content
. 2019 Nov 27;19(23):5192. doi: 10.3390/s19235192
Algorithm 3 Learning a kernel for approximating DTW in the case of multiple references and multiple data streams
Inputn reference patterns {Xi}i=1n, m data streams {Yl}l=1m and parameters R,Lmin,Lmax,β,β+,σ2.
Output a matrix KRn×m containing the kernel values.
  • 1:

    generate a set of R “basis” time series S={s1,s2,,sR}, where each siN(0,σ2)

  • 2:

    fori=1:ndo

  • 3:

        compute ΦS(Xi)=(DTW(Xi,s1),,DTW(Xi,sR))T

  • 4:

        for j=1:n do

  • 5:

            Mi,j=DTW(Xi,Xj)

  • 6:

        end for

  • 7:

    end for

  • 8:

    normalize entries of the matrix M

  • 9:

    choose γ*=arg minγRn2n(n1)i=1n1j=i+1n|(1Kγi(ϕS(Xi),ϕS(Xj))Mi,j)|

  • 10:

    compute every entry of K as Ki,l=dK,γ*(Xi,Yl,a*:b*), where al,b* are obtained solving (9).