# get_pairwise_distance_function¶

get_pairwise_distance_function(metric: ) [source]

Get the pairwise distance function for a given metric string or callable.

metric

Distance Function

‘dtw’

distances.dtw_pairwise_distance

‘shape_dtw’

distances.shape_dtw_pairwise_distance

‘ddtw’

distances.ddtw_pairwise_distance

‘wdtw’

distances.wdtw_pairwise_distance

‘wddtw’

distances.wddtw_pairwise_distance

‘erp’

distances.erp_pairwise_distance

‘edr’

distances.edr_pairwise_distance

‘msm’

distances.msm_pairiwse_distance

‘twe’

distances.twe_pairwise_distance

‘lcss’

distances.lcss_pairwise_distance

‘euclidean’

distances.euclidean_pairwise_distance

‘squared’

distances.squared_pairwise_distance

‘manhattan’

distances.manhattan_pairwise_distance

‘minkowski’

distances.minkowski_pairwise_distance

‘sbd’

distances.sbd_pairwise_distance

Parameters:
metricstr or Callable

The metric string to resolve to a alignment path function. If string given then it will be resolved to a alignment path function. If a callable is given, the value must be a function that accepts two numpy arrays and **kwargs returns a np.ndarray that is the pairwise distance between each time series.

Returns:
Callable[[np.ndarray, np.ndarray, Any], np.ndarray]

The pairwise distance function for the given metric.

Raises:
ValueError

If metric is not one of the supported strings or a callable.

Examples

```>>> from aeon.distances import get_pairwise_distance_function
>>> import numpy as np
>>> x = np.array([[[1, 2, 3]],[[4, 5, 6]], [[7, 8, 9]]])
>>> y = np.array([[[11, 12, 13]],[[14, 15, 16]], [[17, 18, 19]]])
>>> dtw_pairwise_dist_func = get_pairwise_distance_function("dtw")
>>> dtw_pairwise_dist_func(x, y, window=0.2)
array([[300., 507., 768.],
[147., 300., 507.],
[ 48., 147., 300.]])
```