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.

metric

Distance Function

‘dtw’

distances.dtw_alignment_path

‘shape_dtw’

distances.shape_dtw_alignment_path

‘ddtw’

distances.ddtw_alignment_path

‘wdtw’

distances.wdtw_alignment_path

‘wddtw’

distances.wddtw_alignment_path

‘adtw’

distances.adtw_alignment_path

‘erp’

distances.erp_alignment_path

‘edr’

distances.edr_alignment_path

‘msm’

distances.msm_alignment_path

‘twe’

distances.twe_alignment_path

‘lcss’

distances.lcss_alignment_path

Parameters:
metricstr or Callable

The metric string to resolve to a alignment path function.

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)