nikdon/pyEntropy
Entropy for Python
What it solves
pyEntropy gives researchers and analysts a single, easy-to-use Python library for measuring the "regularity" or "complexity" of one-dimensional time series. Instead of coding each mathematical formula from scratch, you call one function to get a number that tells you how predictable or random a signal is. This is useful in fields like brain-wave (EEG) and heart-rate (ECG) analysis, machine vibration monitoring, and finance.
How it works
The library provides ready-made functions for several well-known entropy measures, including sample entropy, permutation entropy, multiscale entropy (and its composite and refined-composite variants), fuzzy entropy, dispersion entropy, and Shannon entropy. Each function takes a list or array of numbers (the time series) and returns one or more entropy values. For example, sample_entropy(x, sample_length=3, tolerance=r) returns values for different embedding dimensions, and multiscale_entropy returns one value per scale. The library has only one dependency (NumPy) and is designed to be fast, with performance benchmarks listed in the README. It also includes a test suite that checks known values, edge cases, and mathematical equivalences.
Who it’s for
pyEntropy is aimed at scientists, engineers, and analysts who work with time-series data and need to quantify its complexity or regularity. Typical use cases mentioned in the README are EEG/ECG analysis, heart-rate variability, vibration and condition monitoring, and finance. It is also suitable for anyone who wants a well-tested, documented implementation of these entropy measures without having to implement them themselves.
Highlights
- Provides 10+ entropy measures, including sample, permutation, multiscale, fuzzy, dispersion, and Shannon entropy.
- Only one dependency: NumPy.
- Fast performance, with benchmark timings for signals up to 100,000 points.
- Thoroughly tested with known values, edge cases, and mathematical equivalences.
- Each function documents its parameters, units, and the original research paper it implements.
- Easy to install via
pip install pyentrpand works with Python 3.10+ and NumPy 1.26+.
Related
- Project
- Project
- Project
- Project
- Project