spkit
.entropy_permutation¶
- spkit.entropy_permutation(x, order=3, delay=1, base=2, normalize=False)¶
Permutation Entropy \(H_{\pi}(X)\)
Permutation Entropy extracts the patterns as order of embeddings, and compute the entropy of the distribuation of the patterns.
The order of embeddings is the sorting order. For example, pattern of embedding e1 = [1,2,-2], is same as pattern of embedding e2 = [1,20,-5].
- Parameters:
- x1d-array, shape (n,)
input signal
- orderint, default=3
Embedding dimension (order).
- delayint, default=1
Delay.
- base: scalar>0, deafult=2
base of log, 2, 10, ‘e’
- normalize: bool, default=False
if True, Hx is normalised
- Returns:
- H_pi: scalar,
Permutation Entropy
See also
entropy
Entropy
entropy_sample
Sample Entropy
entropy_approx
Approximate Entropy
dispersion_entropy
Dispersion Entropy
entropy_spectral
Spectral Entropy
entropy_svd
SVD Entropy
entropy_differential
Differential Entropy
References
Bandt, Christoph, and Bernd Pompe. “Permutation entropy: a natural complexity measure for time series.” Physical review letters 88.17 (2002): 174102.
Examples
>>> import numpy as np >>> import spkit as sp >>> t = np.linspace(0,2,200) >>> x1 = np.sin(2*np.pi*1*t) + 0.01*np.random.randn(len(t)) # less noisy >>> x2 = np.sin(2*np.pi*1*t) + 0.5*np.random.randn(len(t)) # very noisy >>> H_x1 = sp.entropy_permutation(x1,order=3, delay=1) >>> H_x2 = sp.entropy_permutation(x2,order=3, delay=1) >>> print('Permutation Entropy ') >>> print('Entropy of x1: H_p(x1) = ',H_x1) >>> print('Entropy of x2: H_p(x2) = ',H_x2) Permutation Entropy Entropy of x1: H_p(x1) = 1.5156504111997058 Entropy of x2: H_p(x2) = 2.556358399367036