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.
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.
Metadata
Release files for tsfracdiff 1.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| tsfracdiff-1.0.4.tar.gz | 10.4 kB | Without provenance | Details for tsfracdiff-1.0.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| tsfracdiff-1.0.4-py3-none-any.whl | Python 3 | none | any | Details for tsfracdiff-1.0.4-py3-none-any.whl |
Total release size: 19.2 kB
Release files / tsfracdiff-1.0.4.tar.gz
| Download URL | tsfracdiff-1.0.4.tar.gz |
|---|---|
| Size | 10.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bd0264fdfa3dadc8fefa4b98889cb1109e3c507de764d6b028a1e07044ab7073
|
|
BLAKE2b-256 checksum How to use checksums |
fa7ce52f246b1f7ac0c641b454233a4f50cf3bdec99a2d6fb3577078ec588430
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.12
|
Release files / tsfracdiff-1.0.4-py3-none-any.whl
| Download URL | tsfracdiff-1.0.4-py3-none-any.whl |
|---|---|
| Size | 8.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
501c54ec8c84178593e1fd78ce48c209ebfe2f1707f0c457bbb3aa5986274a0b
|
|
BLAKE2b-256 checksum How to use checksums |
9644c1c13c9ed2eb202fcf576a9820e39fdaa5c5fbb5d21e90014bed97f1fe05
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.12
|
Security for tsfracdiff 1.0.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.