msm_distance(x: ndarray, y: ndarray, c: float = 1.0, window: float = None, itakura_max_slope: float = None, bounding_matrix: ndarray = None, **kwargs: dict) float[source]#

Compute the move-split-merge distance.

This metric uses as building blocks three fundamental operations: Move, Split, and Merge. A Move operation changes the value of a single element, a Split operation converts a single element into two consecutive elements, and a Merge operation merges two consecutive elements into one. Each operation has an associated cost, and the MSM distance between two time series is defined to be the cost of the cheapest sequence of operations that transforms the first time series into the second one.

x: np.ndarray (1d or 2d array)

First time series.

y: np.ndarray (1d or 2d array)

Second time series.

c: float, default = 1.0

Cost for split or merge operation.

window: Float, defaults = None

Float that is the radius of the sakoe chiba window (if using Sakoe-Chiba lower bounding). Must be between 0 and 1.

itakura_max_slope: float, defaults = None

Gradient of the slope for itakura parallelogram (if using Itakura Parallelogram lower bounding). Must be between 0 and 1.

bounding_matrix: np.ndarray (2d array of shape (m1,m2)), defaults = None

Custom bounding matrix to use. If defined then other lower_bounding params are ignored. The matrix should be structure so that indexes considered in bound should be the value 0. and indexes outside the bounding matrix should be infinity.

kwargs: any

extra kwargs.


Msm distance between x and y.


If the value of x or y provided is not a numpy array. If the value of x or y has more than 2 dimensions. If a metric string provided, and is not a defined valid string. If a metric object (instance of class) is provided and doesn’t inherit from NumbaDistance. If a resolved metric is not no_python compiled. If the metric type cannot be determined

for time series. IEEE Transactions on Knowledge and Data Engineering,
25(6):1425–1438, 2013.