Autoperiod#

class pyriodicity.Autoperiod#

Autoperiod periodicity detector.

Find the periods in a given signal or series using Autoperiod [1].

See also

pyriodicity.CFDAutoperiod

CFD-Autoperiod periodicity detector.

References

[1]

Vlachos, M., Yu, P., & Castelli, V. (2005). On periodicity detection and Structural Periodic similarity. Proceedings of the 2005 SIAM International Conference on Data Mining. https://doi.org/10.1137/1.9781611972757.40

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 Autoperiod to find the list of periods in the data.

>>> from pyriodicity import Autoperiod
>>> Autoperiod.detect(data)
array([12])

You can specify a lower percentile value should you wish for a more lenient detection

>>> Autoperiod.detect(data, percentile=90)
array([12])

You can also increase the number of random data permutations for a more robust power threshold estimation

>>> Autoperiod.detect(data, k=300)
array([12])

Autoperiod is generally a quite robust periodicity detection method. The detection algorithm found exactly one periodicity length of 12, suggesting a strong yearly periodicity.

Methods

detect(data[, k, percentile, window_func, ...])

Find periods in the given series.