edr_cost_matrix#

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

Compute the edr 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.

epsilonfloat, defaults = None

Matching threshold to determine if two subsequences are considered close enough to be considered ‘common’. If not specified as per the original paper epsilon is set to a quarter of the maximum standard deviation.

Returns:
np.ndarray (n_timepoints, m_timepoints)

edr cost matrix between x and y.

Raises:
ValueError

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

Examples

>>> import numpy as np
>>> from aeon.distances import edr_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]])
>>> edr_cost_matrix(x, y)
array([[0., 1., 1., 1., 1., 1., 1., 1., 1., 1.],
       [1., 0., 1., 2., 2., 2., 2., 2., 2., 2.],
       [1., 1., 0., 1., 2., 3., 3., 3., 3., 3.],
       [1., 2., 1., 0., 1., 2., 3., 4., 4., 4.],
       [1., 2., 2., 1., 0., 1., 2., 3., 4., 5.],
       [1., 2., 3., 2., 1., 0., 1., 2., 3., 4.],
       [1., 2., 3., 3., 2., 1., 0., 1., 2., 3.],
       [1., 2., 3., 4., 3., 2., 1., 0., 1., 2.],
       [1., 2., 3., 4., 4., 3., 2., 1., 0., 1.],
       [1., 2., 3., 4., 5., 4., 3., 2., 1., 0.]])