OrdinalEntroPy is a Python 3 package providing several time efficient, ordinal pattern based entropy algorithms for computing the complexity of one-dimensional time-series. The package consists of following entropy methods:
- Permutation Entropy (PE)
- Weighted Permutation Entropy (WPE)
- Reverse Permutation Entropy (RPE)
- Dispersion Entropy (DE)
- Reverse Dispersion Entropy (RDE)
- [Reverse Weighted Dispersion Entropy (RWDE)]
important:
Currently OrdinalEntroPy is not part of pip repository, therefore you cannot install it using pip or conda.
git clone https://github.com/pradyot-09/OrdinalEntroPy.git /
cd OrdinalEntroPy/
pip install -r requirements.txt
python setup.py develop
Dependencies
code :
from OrdinalEntroPy import *
import numpy as np
np.random.seed(1234567)
x = np.random.rand(3000)
print(PE(x, order=3, normalize=True)) # Permutation entropy
print(WPE(x, order=3, normalize=True)) # Weighted Permutation Entropy
print(RPE(x, order=3, delay=1, normalize=True)) # Reverse Permutation Entropy
print(DE(x, order=3,classes=3, normalize=True)) # Dispersion Entropy
print(RDE(x, order=3,classes=3,delay=1,normalize=True)) # Reverse Dispersion Entropy
print(RWDE(x, order=3,classes=3,delay=1,normalize=True)) # Reverse Weighted Dispersion Entropy
output entropy value :
0.9995858289645746
0.9996533403383996
0.0002963060541583906
0.9830685145488814
0.00418284021851621
0.026268994085565402
OrdinalEntroPy was created and is maintained by Pradyot Patil. Contributions are more than welcome so feel free to contact me, open an issue or submit a pull request!
To see the code or report a bug, please visit the GitHub repository.
Note that this program is provided with NO WARRANTY OF ANY KIND. If you can, always double check the results.
The package and repository structure is adapted from :
- entropy : https://github.com/raphaelvallat/entropy
All the credit goes to the author of this excellently maintained package.