edr_distance#

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

Compute the edr distance between two time series.

EDR computes the minimum number of elements (as a percentage) that must be removed from x and y so that the sum of the distance between the remaining signal elements lies within the tolerance (epsilon). EDR was originally proposed in [1].

The value returned will be between 0 and 1 per time series. The value will represent as a percentage of elements that must be removed for the time series to be an exact match.

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:
float

edr distance between x and y.

Raises:
ValueError

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

References

[1]

Lei Chen, M. Tamer Özsu, and Vincent Oria. 2005. Robust and fast similarity

search for moving object trajectories. In Proceedings of the 2005 ACM SIGMOD international conference on Management of data (SIGMOD ‘05). Association for Computing Machinery, New York, NY, USA, 491–502. DOI:https://doi.org/10.1145/1066157.1066213

Examples

>>> import numpy as np
>>> from aeon.distances import edr_distance
>>> x = np.array([[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]])
>>> y = np.array([[11, 12, 13, 14, 15, 16, 17, 18, 19, 20]])
>>> dist = edr_distance(x, y)