dtw(method=’sakoechiba’)#

pyts.metrics.dtw(x: ArrayLike | None = None, y: ArrayLike | None = None, dist: str | collections.abc.Callable[[float, float], float] = 'square', method: str = 'classic', options: dict[str, Any] | None = None, precomputed_cost: ArrayLike | None = None, return_cost: bool = False, return_accumulated: bool = False, return_path: bool = False) → Any

Dynamic Time Warping (DTW) distance with Sakoe-Chiba band constraint.

The Sakoe-Chiba constraint region is a band centered around the main diagonal. Any cell whose distance to the diagonale is lower than a given value is valid for the path.

See also

For documentation for the rest of the parameters, see dtw().

Options:
window_sizefloat or int (default = 0.1)

The window size above and below the diagonal. If float, window_size must be between 0 and 1, and the actual window size will be computed as ceil(window_size * max((n_timestamps_1, n_timestamps_2) - 1)). If int, window_size must be the largest temporal shift allowed. Each cell whose distance with the diagonal is lower than or equal to window_size becomes a valid cell for the path.

References

[1]

H. Sakoe and S. Chiba, “Dynamic programming algorithm optimization for spoken word recognition”. IEEE Transactions on Acoustics, Speech, and Signal Processing, 26(1), 43-49 (1978).