simple dynamic time warping

10 thoughts on “simple dynamic time warping

  1. Actually i am new to Matlab and working on a speech recognition project.
    I was dealing with the LPC features (i have a matrix for those) and now wanted the so called dynamic time wrapping algorithm but i am finding it difficult to know the parameters of that algorithm as how to get a distance matrix from the one i have with me…

    I would be thankful if you can share your views on it.

    • In the feature matrix, you have the two dimensions time/block index and feature index. Now if you compute a distance between all pairs of feature vectors, you can sort these distances into a (usually symmetric) matrix, your distance matrix.

  2. Is this distance is same as euclidean distance ?

    function d=disteusq(x,y,mode,w)

    like if i am training my system with 30 inputs from 0 to 9 ,3 of each.
    then how can i find this distance while testing to get accurate answer.

    It will be thank u if u can help me out a bit.

    • The choice of the distance metric is arbitrary and depends on the input as well, but yes, the Euclidean distance would be a frequently used one.

  3. Hey thank u for your reply!!

    I need to know one more thing like the D which we are calculating is of two training data , or testing data ?

    • It’s hard to say without knowing what you want to train. Usually you use the distance matrix to find either the similarity between two sequences or to find the warping path between two similar sequences. In the basic implementation there is nothing to train.

  4. Hey thanks!

    I understood your point but if there are more than 1 stored sample and only 1 input sample.
    Do we have to find distance matrix for all stored samples with respect to input samples(like using for loops) ? Or is there any other way ?

    • Sorry, I am not able to follow. I am not even sure what you mean when you use the term sample. Why don’t you clarify this with your advisor?

  5. Hello,

    I have to get alignment results in seconds of two different audio files.

    How can I get it via DTW Algorithm?

    Because as I know, distance is an Euclidean distance metrics. How can I use it to get alignment in seconds?

    Thank you in advance,

    • Well, in short, you will have to follow the following processing steps:
      1. split the signal in (overlapping) blocks and assign time stamp to each block
      2. extract feature(s) per block
      3. compute distance matrix
      4. run DTW to compute alignment path
      5. parse the path and map the time stamp to the block index again

      Hope this helps,

Leave a Reply

Your email address will not be published. Required fields are marked *