Utils¶
The documentation of the approximation module.
The pyts.utils
module includes utility functions.
-
pyts.utils.
segmentation
(ts_size, window_size, overlapping, n_segments=None)[source]¶ Compute the indices for Piecewise Agrgegate Approximation.
Parameters: - ts_size : int
The size of the time series.
- window_size : int
The size of the window.
- overlapping : bool
If True, overlapping windows may be used. If False, non-overlapping are used.
- n_segments : int or None (default = None)
The number of windows. If None, the number is automatically computed using window_size.
Returns: - start : array
The lower bound for each window.
- end : array
The upper bound for each window.
- size : int
The size of start.
-
pyts.utils.
numerosity_reduction
(arr)[source]¶ Perform numerosity reduction.
Parameters: - arr : array-like, shape [n_samples]
Returns: - res : str
string with each word separated with a whitespace.
-
pyts.utils.
dtw
(x, y, dist=u'absolute', return_path=False, **kwargs)[source]¶ Dynamic Time Warping.
Parameters: - x : array-like, shape [n1]
First array.
- y : array-like, shape [n2]
Second array
- dist : {‘absolute’, ‘square’ or callable} (default = ‘absolue’)
The distance metric used. If callable, the first two arguments must be float numbers.
- return_path : bool (default = False)
If true, the path along the accumulated cost matrix is returned.
- kwargs
Additional keyword arguments for dist if dist is callable. Ignored otherwise.
-
pyts.utils.
fast_dtw
(x, y, window_size, approximation=True, dist=u'absolute', return_path=False, **kwargs)[source]¶ Fast Dynamic Time Warping.
Parameters: - x : array-like, shape [n1]
First array.
- y : array-like, shape [n2]
Second array
- window_size : int
The size of the window for the PAA algorithm.
- approximation : bool (default = True)
If True, compute Dynamic Time Warping between the shrunk time series. If False, compute Dynamic Time Warping on the original time series with a constraint region based on the path of the Dynamic Time Warping of the shrunk time series.
- dist : {‘absolute’, ‘square’ or callable} (default = ‘absolue’)
The distance metric used. If callable, the first two arguments must be float numbers.
- return_path : bool (default = False)
If true, the path along the accumulated cost matrix is returned.
- kwargs
Additional keyword arguments for dist if dist is callable. Ignored otherwise.