ddtw_cost_matrix#

ddtw_cost_matrix(x: ndarray, y: ndarray, window: float = None) ndarray[source]#

Compute the ddtw cost matrix between two time series.

Parameters:
x: np.ndarray, of shape (n_channels, n_timepoints) or (n_timepoints,)

First time series.

y: np.ndarray, of shape (m_channels, m_timepoints) or (m_timepoints,)

Second time series.

window: float, default=None

The window to use for the bounding matrix. If None, no bounding matrix is used.

Returns:
np.ndarray (n_timepoints, m_timepoints)

ddtw cost matrix between x and y.

Raises:
ValueError

If x and y are not 1D, or 2D arrays. If n_timepoints or m_timepoints are less than 2.

Examples

>>> import numpy as np
>>> from aeon.distances import ddtw_cost_matrix
>>> x = np.array([[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]])
>>> y = np.array([[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]])
>>> ddtw_cost_matrix(x, y)
array([[0., 0., 0., 0., 0., 0., 0., 0.],
       [0., 0., 0., 0., 0., 0., 0., 0.],
       [0., 0., 0., 0., 0., 0., 0., 0.],
       [0., 0., 0., 0., 0., 0., 0., 0.],
       [0., 0., 0., 0., 0., 0., 0., 0.],
       [0., 0., 0., 0., 0., 0., 0., 0.],
       [0., 0., 0., 0., 0., 0., 0., 0.],
       [0., 0., 0., 0., 0., 0., 0., 0.]])