get_alignment_path_function#

get_alignment_path_function(metric: str) Callable[[ndarray, ndarray, Any], Tuple[List[Tuple[int, int]], float]][source]#

Get the alignment path function for a given metric string or callable.

Parameters:
metric: str or Callable

The distance metric to use. The value must be one of the following strings: ‘dtw’, ‘ddtw’, ‘wdtw’, ‘wddtw’, ‘lcss’, ‘edr’, ‘erp’, ‘msm’

Returns:
Callable[[np.ndarray, np.ndarray, Any], Tuple[List[Tuple[int, int]], float]]

The alignment path function for the given metric.

Raises:
ValueError

If metric is not one of the supported strings or a callable. If the metric doesn’t have an alignment path function.

Examples

>>> from aeon.distances import get_alignment_path_function
>>> import numpy as np
>>> x = np.array([[1, 2, 3, 4, 5]])
>>> y = np.array([[11, 12, 13, 14, 15]])
>>> dtw_alignment_path_func = get_alignment_path_function("dtw")
>>> dtw_alignment_path_func(x, y, window=0.2)
([(0, 0), (1, 1), (2, 2), (3, 3), (4, 4)], 500.0)