shape_dtw_alignment_path¶
- shape_dtw_alignment_path(x: ndarray, y: ndarray, window: float | None = None, descriptor: str = 'identity', reach: int = 15, itakura_max_slope: float | None = None, transformation_precomputed: bool = False, transformed_x: ndarray | None = None, transformed_y: ndarray | None = None) tuple[list[tuple[int, int]], float] [source]¶
Compute the ShapeDTW alignment path 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=15.
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:
- List[Tuple[int, int]]
The alignment path between the two time series where each element is a tuple of the index in x and the index in y that have the best alignment according to the cost matrix.
- Raises:
- ValueError
If x and y are not 1D or 2D arrays.