Skip to main content

Smart, automatic detection and stationarization of non-stationary time series data.

Project description

PyPI-Status PyPI-Versions Build-Status Codecov Codacy Badge Requirements Status LICENCE

Smart, automatic detection and stationarization of non-stationary time series data.

>>> from stationarizer import simple_auto_stationarize
>>> simple_auto_stationarize(my_dataframe)

1 Installation

pip install stationarizer

2 Features

  • Plays nice with pandas.DataFrame inputs.

  • Pure python.

  • Supports Python 3.6+.

3 Use

Simple auto-stationarization

The only stationarization pipeline implemented is simple_auto_stationarize, which can be called with:

>>> from stationarizer import simple_auto_stationarize
>>> stationarized_df = simple_auto_stationarize(my_dataframe)

The level to which false discovery rate (FDR) is controled can be configured with the alpha parameter, while the method for multitest error control can be configured with multitest (changing this can change alpha to control for FWER instead).

4 Methodology

Simple auto-stationarization

Currently only the following simple flow - dealing with unit roots - is implemented:

  • Data validation is performed: all columns are checked to be numeric, and the time dimension is assumed to be larger than the number of series (although this is not mandatory, and so only a warning is thrown in case of violation).

  • Both the Augmented Dickey-Fuller unit root test and the KPSS test are performed for each of the series.

  • The p-values of all tests are corrected to control the false discovery rate (FDR) at some given level, using the Benjamini–Yekutieli procedure.

  • The joint ADF-KPSS results are interpreted for each test.

  • For each time series for which the presence of a unit root cannot be rejected, the series is diffentiated.

  • For each time series for which the presence of a trend cannot be rejected, the series is de-trended.

  • If any series was diffrentiated, then any un-diffrentiated time series (if any) are trimmed by one step to match the resulting series length.

5 Contributing

Package author and current maintainer is Shay Palachy (shay.palachy@gmail.com); You are more than welcome to approach him for help. Contributions are very welcomed.

5.1 Installing for development

Clone:

git clone git@github.com:shaypal5/stationarizer.git

Install in development mode, including test dependencies:

cd stationarizer
pip install -e '.[test]'

To also install fasttext, see instructions in the Installation section.

5.2 Running the tests

To run the tests use:

cd stationarizer
pytest

5.3 Adding documentation

The project is documented using the numpy docstring conventions, which were chosen as they are perhaps the most widely-spread conventions that are both supported by common tools such as Sphinx and result in human-readable docstrings. When documenting code you add to this project, follow these conventions.

Additionally, if you update this README.rst file, use python setup.py checkdocs to validate it compiles.

6 Credits

Created by Shay Palachy (shay.palachy@gmail.com).

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

stationarizer-0.0.11.tar.gz (25.5 kB view details)

Uploaded Source

Built Distribution

stationarizer-0.0.11-py3-none-any.whl (11.5 kB view details)

Uploaded Python 3

File details

Details for the file stationarizer-0.0.11.tar.gz.

File metadata

  • Download URL: stationarizer-0.0.11.tar.gz
  • Upload date:
  • Size: 25.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.5

File hashes

Hashes for stationarizer-0.0.11.tar.gz
Algorithm Hash digest
SHA256 e3f3e1a64e7ec7eae93175f0cacb8f9ec8e415fa02dbfbad9dda3f5e2667d40f
MD5 c9d8fc090c1750eaaa674a61fa9e369d
BLAKE2b-256 3f8d12b5b691d7a89dd1a24417d170d9d1e176264440464778032119b1ca7b2d

See more details on using hashes here.

File details

Details for the file stationarizer-0.0.11-py3-none-any.whl.

File metadata

  • Download URL: stationarizer-0.0.11-py3-none-any.whl
  • Upload date:
  • Size: 11.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.5

File hashes

Hashes for stationarizer-0.0.11-py3-none-any.whl
Algorithm Hash digest
SHA256 8cc62fc9f9294601c15d6d5bbb972a0fbbde03c79995ca60ede6ceafc379e2b3
MD5 32aeb0bbf8668e281c85730e58019d4f
BLAKE2b-256 ac308aa98cdd58ab7f1e62dd0b56d326f5071a853b1fd72b00c9c7ae4d2a164a

See more details on using hashes here.

Supported by

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