Skip to main content

Pyriodicity provides an intuitive and efficient Python implementation of periodicity length detection methods in univariate signals.

Project description

Pyriodicity

PyPI Version PyPI - Python Version GitHub License Codecov Docs CI Build

About Pyriodicity

Pyriodicity provides an intuitive and efficient Python implementation of periodicity length detection methods in univariate signals. You can check the supported detection methods in the API Reference page.

Installation

To install pyriodicity, simply run:

pip install pyriodicity

To install the latest development version, you can run:

pip install git+https://github.com/iskandergaba/pyriodicity.git

Usage

Please refer to the package documentation for more information.

For this example, 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 periodicity lengths in this data, if any.

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

The detected periodicity length is 12 which suggests a strong yearly seasonality given that the data has a monthly frequency.

We can also use online detection methods for data streams as follows.

>>> from pyriodicity import OnlineACFPeriodicityDetector
>>> data_stream = (sample for sample in data.values)
>>> detector = OnlineACFPeriodicityDetector(window_size=128)
>>> for sample in data_stream:
...   periods = detector.detect(sample)
>>> 12 in periods
True

All the supported periodicity detection methods can be used in the same manner as in the examples above with different optional parameters. Check the API Reference for more details.

References

  • [1] Hyndman, R.J., & Athanasopoulos, G. (2021) Forecasting: principles and practice, 3rd edition, OTexts: Melbourne, Australia. OTexts.com/fpp3. Accessed on 09-15-2024.
  • [2] Vlachos, M., Yu, P., & Castelli, V. (2005). On periodicity detection and Structural Periodic similarity. Proceedings of the 2005 SIAM International Conference on Data Mining. doi.org/10.1137/1.9781611972757.40.
  • [3] Puech, T., Boussard, M., D'Amato, A., & Millerand, G. (2020). A fully automated periodicity detection in time series. In Advanced Analytics and Learning on Temporal Data: 4th ECML PKDD Workshop, AALTD 2019, Würzburg, Germany, September 20, 2019, Revised Selected Papers 4 (pp. 43-54). Springer International Publishing. doi.org/10.1007/978-3-030-39098-3_4.
  • [4] Wen, Q., He, K., Sun, L., Zhang, Y., Ke, M., & Xu, H. (2021, June). RobustPeriod: Robust time-frequency mining for multiple periodicity detection. In Proceedings of the 2021 international conference on management of data (pp. 2328-2337). https://doi.org/10.1145/3448016.3452779.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyriodicity-0.5.0.tar.gz (17.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyriodicity-0.5.0-py3-none-any.whl (27.0 kB view details)

Uploaded Python 3

File details

Details for the file pyriodicity-0.5.0.tar.gz.

File metadata

  • Download URL: pyriodicity-0.5.0.tar.gz
  • Upload date:
  • Size: 17.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.6.14

File hashes

Hashes for pyriodicity-0.5.0.tar.gz
Algorithm Hash digest
SHA256 64c68514690411817c1a3013c4d07c4edb8afc142ab3b7274ef34a50d05f8ed3
MD5 b78dfc4234cb5fbff64e7091cfc1ff51
BLAKE2b-256 1ec2914b373ca3163d7686193612560217aed2b92e808a978269a91c87e46805

See more details on using hashes here.

File details

Details for the file pyriodicity-0.5.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pyriodicity-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7362fb30825b57c727eb81cacbcbe168faae0354153935779a511477e45c3560
MD5 e10a25c5155d9494daa932d693e4ae37
BLAKE2b-256 7d60a89a20404497843b832fb076925281d7831494d51838a2fb8ec8f79a4491

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page