# wddtw_pairwise_distance¶

wddtw_pairwise_distance(X: , y: = None, window: = None, g: float = 0.05, itakura_max_slope: = None) [source]

Compute the WDDTW pairwise distance between a set of time series.

Parameters:
Xnp.ndarray or List of np.ndarray

A collection of time series instances of shape `(n_cases, n_timepoints)` or `(n_cases, n_channels, n_timepoints)`.

ynp.ndarray or List of np.ndarray or None, default=None

A single series or a collection of time series of shape `(m_timepoints,)` or `(m_cases, m_timepoints)` or `(m_cases, m_channels, m_timepoints)`. If None, then the wddtw pairwise distance between the instances of X is calculated.

windowfloat, default=None

The window to use for the bounding matrix. If None, no bounding matrix is used.

gfloat, default=0.05

Constant that controls the level of penalisation for the points with larger phase difference. Default is 0.05.

itakura_max_slopefloat, default=None

Maximum slope as a proportion of the number of time points used to create Itakura parallelogram on the bounding matrix. Must be between 0. and 1.

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])
>>> wddtw_pairwise_distance(X, y_univariate)
array([[  7469.9486745 ],
[159295.70501427],
[  1590.15378267]])
```
```>>> # Distance between each TS in a collection of unequal-length time series
>>> X = [np.array([1, 2, 3]), np.array([4, 5, 6, 7]), np.array([8, 9, 10, 11, 12])]
>>> wddtw_pairwise_distance(X)
array([[0., 0., 0.],
[0., 0., 0.],
[0., 0., 0.]])
```