dtaidistance.preprocessing
Preprocessing time series.
- author:
Wannes Meert
- copyright:
Copyright 2021-2024 KU Leuven, DTAI Research Group.
- license:
Apache License, Version 2.0, see LICENSE for details.
- dtaidistance.preprocessing.derivative(series, smooth=None)
Derivative series.
Based on Keogh, E. and Pazzani, M. “Derivative Dynamic Time Warping”. SIAM International Conference on Data Mining, 2002.
The smoothing argument is used to smooth after computing the derivative. To apply the smoothing as explained in Keogh et al. (2002) one should do exponential smoothing before applying this method.
- Parameters:
series – Time series (must be numpy compatible)
smooth – Smooth the derivative series by removing the highest frequencies. The cut-off frequency is computed using the smooth argument. This fraction (a number between 0.0 and 0.5) of the highest frequencies is removed.
- Returns:
Differenced Numpy array of length len(series) - 1
- dtaidistance.preprocessing.differencing(series, smooth=None, diff_args=None)
Differencing series.
- Parameters:
series – Time series (must be numpy compatible)
smooth – Smooth the differenced series by removing the highest frequencies. The cut-off frequency is computed using the smooth argument. This fraction (a number between 0.0 and 0.5) of the highest frequencies is removed.
diff_args – Arguments to pass the numpy.diff
- Returns:
Differenced Numpy array of length len(series) - 1
- dtaidistance.preprocessing.logdomain(series)
Transform to the log domain and retain the sign of the signal.
- Parameters:
series – Time series (must be numpy compatible)
- dtaidistance.preprocessing.mixedlinearlogdomain(series, c=10)
Transform to a mixture between linear and log domain (and retain the sign of the signal).
The transformation is (for positive values): x if x<=c c+ln(x-c+1) if x>c
- Parameters:
series – Time series (must be numpy compatible)
c (Union[int,list]) – Switch between linear to log domain at this value, should be <= 1. If two numbers are given as a tuple, the first one is used for positive values, the second for negative values.
- dtaidistance.preprocessing.smoothing(series, smooth)
Smooth the series.
Since version 2.4 the filter uses Gustafsson’s method for handling the edges of the series.
- Parameters:
series – Time series (must be numpy compatible)
smooth – Smooth the series by removing the highest frequencies. The cut-off frequency is computed using the smooth argument. This fraction (a number between 0.0 and 0.5) of the highest frequencies is removed.
- Returns:
Smoothed series as Numpy array
- dtaidistance.preprocessing.znormal(series)
Z-normalize the time series.
- Parameters:
series – Time series (must be a numpy compatible)
- Returns:
Z-normalized Numpy array