pyts.metrics.sakoe_chiba_band(n_timestamps_1, n_timestamps_2=None, window_size=0.1)[source]

Compute the Sakoe-Chiba band.

n_timestamps_1 : int

The size of the first time series.

n_timestamps_2 : int (optional, default None)

The size of the second time series. If None, set to n_timestamps_1.

window_size : float or int (default = 0.1)

The window size above and below the diagonale. 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 diagonale is lower than or equal to ‘window_size’ becomes a valid cell for the path.

region : array, shape = (2, n_timestamps_1)

Constraint region. The first row consists of the starting indices (included) and the second row consists of the ending indices (excluded) of the valid rows for each column.


[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).


>>> from pyts.metrics import sakoe_chiba_band
>>> print(sakoe_chiba_band(5, window_size=0.5))
[[0 0 0 1 2]
 [3 4 5 5 5]]

Examples using pyts.metrics.sakoe_chiba_band

Dynamic Time Warping

Dynamic Time Warping

Dynamic Time Warping
Sakoe-Chiba band

Sakoe-Chiba band

Sakoe-Chiba band