dominant_fourier_frequency
- dtaianomaly.windowing.dominant_fourier_frequency(X: ndarray, lower_bound: int = 10, upper_bound: int = 1000) int[source]
Compute the window size by selecting the dominant Fourier frequency.
The Fourier transform decomposes a time series into a weighted sum of sine-waves. These weights are called the fourier coefficients and are related to a specific frequency or period length. The assumption is that the greatest coefficient corresponds to the dominant sine-wave which captures the time series characteristics best. The window size is therefore computed as the period of this dominant sine-wave.
- Parameters:
- Xarray-like of shape (n_samples,)
Input time series.
- lower_boundint, default=10
The lower bound on the automatically computed window size.
- upper_boundint, default=1000
The lower bound on the automatically computed window size.
- Returns:
- int
The computed window size.
Warning
Automatically computing the windwow size only works for univariate time series!
Examples
>>> from dtaianomaly.data import demonstration_time_series >>> from dtaianomaly.windowing import dominant_fourier_frequency >>> X, _ = demonstration_time_series() >>> dominant_fourier_frequency(X) 107