Learn R Programming

dtw (version 0.1-2)

dtwWindowingFunctions: Sakoe-Chiba band and other windowing for DTW

Description

Windowing functions used by dtw.

Usage

noWindow(iii, jjj);
sakoeChibaWindow(iii, jjj);
itakuraWindow(iii, jjj);

Arguments

iii
Index in the query
jjj
Index in the template

Value

  • The functions return TRUE if the given coordinates fall within the chosen warping window, FALSE otherwise. User-defined functions should do the same.

concept

  • Dynamic Time Warp
  • Windowing
  • Sakoe-Chiba Band
  • Itakura Parallelogram

Details

These functions, and user-defined equivalents to be passed to the window.type argument in dtw, take two integer arguments and return a boolean value stating if the coordinates fall within the allowed window for warping paths. User-defined functions can read variables template.size, query.size and window.size; these are forwarded by dtw. User-defined functions are free to implement any window shape, as long as at least one path is allowed between the initial and final alignment points, i.e., they are compatible with the DTW constraints.

Windowing in the rectangular case is supported as a package-specific extension (see note). If the cost matrix is non-square, the built-in window types sakoeChibaWindow and itakuraWindow are automatically adjusted (see note). The Sakoe-Chiba band, in particular, is centered about the (jagged) line which joins element [1,1] to element [n,m], and will be window.size columns wide.

References

TODO

Examples

Run this code
## The sakoeChibaWindow function is currently crudely defined as
function(iii,jjj) {
  diagj<-(iii*template.size/query.size);
  return(abs(jjj-diagj)<=window.size);
  }

Run the code above in your browser using DataLab