erp_pairwise_distance#
- erp_pairwise_distance(X: ndarray, y: ndarray = None, window: float = None, g: float = 0.0, g_arr: ndarray = None) ndarray [source]#
Compute the erp pairwise distance between a set of 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_instances, n_channels, n_timepoints) or
(n_instances, n_timepoints)
A collection of time series instances.
- y: np.ndarray, of shape (m_instances, m_channels, m_timepoints) or
(m_instances, m_timepoints) or (m_timepoints,), default=None
A collection of time series instances.
- 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:
- np.ndarray (n_instances, n_instances)
erp pairwise matrix between the instances of X.
- Raises:
- ValueError
If X is not 2D or 3D array when only passing X. If X and y are not 1D, 2D or 3D arrays when passing both X and y.
Examples
>>> import numpy as np >>> from aeon.distances import erp_pairwise_distance >>> # Distance between each time series in a collection of time series >>> X = np.array([[[1, 2, 3]],[[4, 5, 6]], [[7, 8, 9]]]) >>> erp_pairwise_distance(X) array([[ 0., 9., 18.], [ 9., 0., 9.], [18., 9., 0.]])
>>> # Distance between two collections of time series >>> X = np.array([[[1, 2, 3]],[[4, 5, 6]], [[7, 8, 9]]]) >>> y = np.array([[[11, 12, 13]],[[14, 15, 16]], [[17, 18, 19]]]) >>> erp_pairwise_distance(X, y) array([[30., 39., 48.], [21., 30., 39.], [12., 21., 30.]])
>>> X = np.array([[[1, 2, 3]],[[4, 5, 6]], [[7, 8, 9]]]) >>> y_univariate = np.array([[11, 12, 13],[14, 15, 16], [17, 18, 19]]) >>> erp_pairwise_distance(X, y_univariate) array([[30.], [21.], [12.]])