shape_dtw_cost_matrix

shape_dtw_cost_matrix(x: ndarray, y: ndarray, window: float | None = None, descriptor: str = 'identity', reach: int = 30, itakura_max_slope: float | None = None, transformation_precomputed: bool = False, transformed_x: ndarray | None = None, transformed_y: ndarray | None = None) ndarray[source]

Compute the ShapeDTW cost matrix between two series x and y.

Parameters:
xnp.ndarray

First time series, either univariate, shape (n_timepoints,), or multivariate, shape (n_channels, n_timepoints).

ynp.ndarray

Second time series, either univariate, shape (n_timepoints,), or multivariate, shape (n_channels, n_timepoints).

windowfloat or None, default=None

The window to use for the bounding matrix. If None, no bounding matrix is used. window is a percentage deviation, so if window = 0.1 then 10% of the series length is the max warping allowed. is used.

descriptorstr, default=None (if None then identity is used).

Defines which transformation is applied on the sub-sequences. Valid descriptors are: [‘identity’]

Identity is simply a copying mechanism of the sub-sequence, no transformations are done. For now no other descriptors are implemented.

If not specified then identity is used.

reachint, default=30.

Length of the sub-sequences.

itakura_max_slopefloat, default=None

Maximum slope as a proportion of the number of time points used to create Itakura parallelogram on the bounding matrix. Must be between 0. and 1.

transformation_precomputedbool, default = False

To choose if the transformation of the sub-sequences is pre-computed or not.

transformed_xnp.ndarray, default = None

The transformation of x, ignored if transformation_precomputed is False.

transformed_ynp.ndarray, default = None

The transformation of y, ignored if transformation_precomputed is False.

Returns:
np.ndarray (n_timepoints, m_timepoints)

shapedtw cost matrix between x and y.

Raises:
ValueError

If x and y are not 1D or 2D arrays.