slope_derivative¶
- slope_derivative(X: ndarray) ndarray¶
Compute the average of a slope between points.
a.k.a. slope derivative.
Computes the average of the slope of the line through the point in question and its left neighbour, and the slope of the line through the left neighbour and the right neighbour. Proposed in [1] for use in distances i.e. ddtw and wddtw. .. math:: q’_(i) = frac{{}(q_{i} - q_{i-1} + ((q_{i+1} - q_{i-1}/2)}{2} Where q is the original time series and q’ is the derived time series.
- Parameters:
- Xnp.ndarray (n_timepoints)
Time series to take derivative of.
- Returns:
- np.ndarray (n_timepoints - 2)
Array containing the derivative of X.
- Raises:
- ValueError
If the time series length has less than 3 points.
References
[1]Keogh, Eamonn & Pazzani, Michael. (2002). Derivative Dynamic Time Warping. First SIAM International Conference on Data Mining. 1. 10.1137/1.9781611972719.1.
Examples
>>> import numpy as np >>> from aeon.utils.numba.general import slope_derivative >>> X = np.array([1, 2, 2, 3, 3, 3, 4, 4, 4, 4]) >>> X_der = slope_derivative(X)