SAZED#

class pyriodicity.SAZED#

Spectral Autocorrelation Zero Ensemble Detector (SAZED).

Find the periods in a given signal or series using SAZED ensemble method [1].

Notes

While the original paper uses the Sheather-Jones bandwidth selector in the kernel density estimation, this implementation uses Scott’s rule provided by scipy.stats.gaussian_kde for convenience, as it is unclear how much better is Sheather-Jones selector in practice.

References

[1]

Toller, M., Santos, T., & Kern, R. (2019). SAZED: parameter-free domain-agnostic season length estimation in time series data. Data Mining and Knowledge Discovery, 33(6), 1775-1798. https://doi.org/10.1007/s10618-019-00645-z

Examples

Start by loading Mauna Loa Weekly Atmospheric CO2 Data from statsmodels and downsampling its data to a monthly frequency.

>>> from statsmodels.datasets import co2
>>> data = co2.load().data
>>> data = data.resample("ME").mean().ffill()

Use SAZED to find periods using the ensemble method.

>>> from pyriodicity import SAZED
>>> SAZED.detect(data)
np.int64(12)

You can also use the majority voting method:

>>> SAZED.detect(data, method="majority")
np.int64(12)

Methods

detect(data[, window_func, detrend_func, method])

Detect a period in the input data using the SAZED ensemble method.