erp_alignment_path#
- erp_alignment_path(x: ndarray, y: ndarray, window: float = None, g: float = 0.0, g_arr: ndarray = None) Tuple[List[Tuple[int, int]], float] [source]#
Compute the erp alignment path between two time series.
The optimal value of g is selected from the range [σ/5, σ], where σ is the standard deviation of the training data. When there is > 1 channel, g should be a np.ndarray where the nth value is the standard deviation of the nth channel.
- 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.
- g: float.
The reference value to penalise gaps. The default is 0.
- g_arr: np.ndarray of shape (n_channels), defaults=None
Numpy array that must be the length of the number of channels in x and y.
- 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.
- float
The erp distance betweeen the two time series.
- Raises:
- ValueError
If x and y are not 1D or 2D arrays.
Examples
>>> import numpy as np >>> from aeon.distances import erp_alignment_path >>> x = np.array([[1, 2, 3, 6]]) >>> y = np.array([[1, 2, 3, 4]]) >>> erp_alignment_path(x, y) ([(0, 0), (1, 1), (2, 2), (3, 3)], 2.0)