Windowing module

A common parameter in many time series anomaly detection algorithms is the window size. This module functionality to create a sliding window, but also to automatically compute the window size. It can be imported as follows:

>>> from dtaianomaly import windowing

The available identifiers for automatically computing the window size for a given time series can be accessed as follows:

>>> from dtaianomaly.windowing import AUTO_WINDOW_SIZE_COMPUTATION
>>> AUTO_WINDOW_SIZE_COMPUTATION
['fft', 'acf', 'mwf', 'suss']

A predefined type is declared for the valid window sizes which can be passed to compute_window_size():

>>> from dtaianomaly.windowing import WINDOW_SIZE_TYPE
>>> WINDOW_SIZE_TYPE
int | typing.Literal['fft', 'acf', 'mwf', 'suss']

Note

The implementations in this module are based on the following repository: https://github.com/ermshaua/window-size-selection

Base functions

sliding_window(X, window_size, stride)

Construct a sliding window for the given time series.

reverse_sliding_window(...)

Reverse the sliding window.

Automatically computing the window size

compute_window_size(X, window_size[, ...])

Compute the window size of the given time series [11].

dominant_fourier_frequency(X[, lower_bound, ...])

Compute the window size by selecting the dominant Fourier frequency.

highest_autocorrelation(X[, lower_bound, ...])

Compute the window size as the leg with the highest autocorrelation.

multi_window_finder(X[, lower_bound, ...])

Compute the window size using the Multi-Window-Finder method [18].

summary_statistics_subsequences(X[, ...])

Compute the window size using the Summary Statistics Subsequence method [10].