Skip to main content

Efficient and easy to use fractional differentiation transformations for stationarizing time series data.

Project description

Build PyPi Downloads License

Efficient and easy to use fractional differentiation transformations for stationarizing time series data in Python.


tsfracdiff

Data with high persistence, serial correlation, and non-stationarity pose significant challenges when used directly as predictive signals in many machine learning and statistical models. A common approach is to take the first difference as a stationarity transformation, but this wipes out much of the information available in the data. For datasets where there is a low signal-to-noise ratio such as financial market data, this effect can be particularly severe. Hosking (1981) introduces fractional (non-integer) differentiation for its flexibility in modeling short-term and long-term time series dynamics, and López de Prado (2018) proposes the use of fractional differentiation as a feature transformation for financial machine learning applications. This library is an extension of their ideas, with some modifications for efficiency and robustness.

Documentation

Getting Started

Installation

pip install tsfracdiff

Dependencies:

# Required
python3 # Python 3.7+
numpy
pandas
arch

# Suggested
joblib

Usage

# A pandas.DataFrame/np.array with potentially non-stationary time series
df 

# Automatic stationary transformation with minimal information loss
from tsfracdiff import FractionalDifferentiator
fracDiff = FractionalDifferentiator()
df = fracDiff.FitTransform(df)

For a more in-depth example, see this notebook.

References

Hosking, J. R. M. (1981). Fractional Differencing. Biometrika, 68(1), 165--176. https://doi.org/10.2307/2335817

López de Prado, Marcos (2018). Advances in Financial Machine Learning. John Wiley & Sons, Inc.

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

tsfracdiff-1.0.4.tar.gz (10.4 kB view details)

Uploaded Source

Built Distribution

tsfracdiff-1.0.4-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

Details for the file tsfracdiff-1.0.4.tar.gz.

File metadata

  • Download URL: tsfracdiff-1.0.4.tar.gz
  • Upload date:
  • Size: 10.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.12

File hashes

Hashes for tsfracdiff-1.0.4.tar.gz
Algorithm Hash digest
SHA256 bd0264fdfa3dadc8fefa4b98889cb1109e3c507de764d6b028a1e07044ab7073
MD5 5aef82e084d9e86b0a99a1783d01f2ff
BLAKE2b-256 fa7ce52f246b1f7ac0c641b454233a4f50cf3bdec99a2d6fb3577078ec588430

See more details on using hashes here.

File details

Details for the file tsfracdiff-1.0.4-py3-none-any.whl.

File metadata

  • Download URL: tsfracdiff-1.0.4-py3-none-any.whl
  • Upload date:
  • Size: 8.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.12

File hashes

Hashes for tsfracdiff-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 501c54ec8c84178593e1fd78ce48c209ebfe2f1707f0c457bbb3aa5986274a0b
MD5 42068ae7bcb3132c036b45af7a920215
BLAKE2b-256 9644c1c13c9ed2eb202fcf576a9820e39fdaa5c5fbb5d21e90014bed97f1fe05

See more details on using hashes here.

Supported by

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