segmentation#
- pyts.utils.segmentation(ts_size: int, window_size: int, overlapping: bool = False, n_segments: int | None = None) tuple[NDArray[int64], NDArray[int64], int][source]#
Compute the indices for Piecewise Agrgegate Approximation.
- Parameters:
- ts_sizeint
The size of the time series.
- window_sizeint
The size of the window.
- overlappingbool (default = False)
If True, overlapping windows may be used. If False, non-overlapping are used.
- n_segmentsint or None (default = None)
The number of windows. If None, the number is automatically computed using
window_size.
- Returns:
- startarray
The lower bound for each window.
- endarray
The upper bound for each window.
- sizeint
The size of
start.
Examples
>>> from pyts.utils import segmentation >>> start, end, size = segmentation(ts_size=12, window_size=3) >>> print(start) [0 3 6 9] >>> print(end) [ 3 6 9 12] >>> size 4