wddtw_pairwise_distance#
- wddtw_pairwise_distance(X: ndarray, y: ndarray = None, window: float = None, g: float = 0.05) ndarray [source]#
Compute the wddtw pairwise distance between a set of time series.
- 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, defaults=0.05
Constant that controls the level of penalisation for the points with larger phase difference. Default is 0.05.
- 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. If n_timepoints is less than 2.
Examples
>>> import numpy as np >>> from aeon.distances import wddtw_pairwise_distance >>> # Distance between each time series in a collection of time series >>> X = np.array([[[1, 2, 3]],[[49, 58, 61]], [[73, 82, 99]]]) >>> wddtw_pairwise_distance(X) array([[ 0. , 20.86095125, 49.37503255], [20.86095125, 0. , 6.04844149], [49.37503255, 6.04844149, 0. ]])
>>> # Distance between two collections of time series >>> X = np.array([[[19, 12, 39]],[[40, 51, 69]], [[79, 28, 91]]]) >>> y = np.array([[[110, 15, 123]],[[14, 150, 116]], [[9917, 118, 29]]]) >>> wddtw_pairwise_distance(X, y) array([[1.03345029e+03, 4.17910276e+03, 2.68408251e+07], [1.60419481e+03, 3.21952986e+03, 2.69227971e+07], [2.33574763e+02, 6.64390438e+03, 2.66663693e+07]])
>>> X = np.array([[[10, 22, 399]],[[41, 500, 1316]], [[117, 18, 9]]]) >>> y_univariate = np.array([[100, 11, 199],[10, 15, 26], [170, 108, 1119]]) >>> wddtw_pairwise_distance(X, y_univariate) array([[ 7469.9486745 ], [159295.70501427], [ 1590.15378267]])