spkit.entropy_differential

spkit.entropy_differential(x, is_multidim=True, emb_dim=1, delay=1, exclude_constants=True, return_cov=False, raise_error=False)

Differential Entropy \(H_{\partial}(X)\)

Differential Entropy of Normally distribuated Multivariant X

for

\[x ∼ N(μ,Σ)\]

entropy in nats

\[H_{\partial}(x) = (1/2)ln|Σ| + (1/2)n + (n/2)ln(2π)\]

\(H_{\partial}(X)\)

\((1/2)n + (n/2)ln(2π)\) => are constant values for fixed dimension

Parameters:
x: 1d-array, if is_multidim = False, else 2d array

with (m, N) for N-dimensional space

if is_multidim=False:
  • emb_dim: int>=1, default=1

  • delay: int>=1, default=1,

are used to create multidimensional array

exclude_constants: if True, then (1/2)n + (n/2)ln(2π) are excluded
Returns:
H_x: scaler
  • Differential Entropy

See also

dispersion_entropy

Dispersion Entropy

dispersion_entropy_multiscale_refined

Dispersion Entropy Multiscale

entropy

Entropy

entropy_sample

Sample Entropy

entropy_approx

Approximate Entropy

entropy_spectral

Spectral Entropy

entropy_svd

SVD Entropy

entropy_permutation

Permutation Entropy

References

IEEE Transactions on Information Theory. 35 (3): 688–692. doi:10.1109/18.30996.

Examples

import numpy as np
import matplotlib.pyplot as plt
import spkit as sp
x0, fs = sp.data.optical_sample(sample=3)
t = np.arange(len(x0))/fs
x1 = x0 + 0.5*np.random.randn(len(t))
# create multi-dimensional space signals
X0 = sp.signal_delayed_space(x0,emb_dim=3,delay=2)
X1 = sp.signal_delayed_space(x1,emb_dim=3,delay=2)
# Compute Differential Entropy
Hd0 = sp.entropy_differential(X0)
Hd1 = sp.entropy_differential(X1)
print('Differential Entropy')
print(' - x0: ',Hd0)
print(' - x1: ',Hd1)
# Or Compute directly - Compute Differential Entropy
Hd0 = sp.entropy_differential(x0,is_multidim=False,emb_dim=3, delay=2)
Hd1 = sp.entropy_differential(x1,is_multidim=False,emb_dim=3, delay=2)
print('Differential Entropy')
print(' - x0: ',Hd0)
print(' - x1: ',Hd1)