skdh.features.SignalEntropy#
- class skdh.features.SignalEntropy#
A Measure of the information contained in a signal. Also described as a measure of how surprising the outcome of a variable is.
Methods
compute(signal, *[, axis])Compute the signal entropy
Notes
The entropy is estimated using the histogram of the input signal. Bin limits for the histogram are defined per
\[n_{bins} = ceil(\sqrt{N}) \delta = \frac{x_{max} - x_{min}}{N - 1} bin_{min} = x_{min} - \frac{\delta}{2} bin_{max} = x_{max} + \frac{\delta}{2}\]where \(N\) is the number of samples in the signal. Note that the data is standardized before computing (using mean and standard deviation).
With the histogram, then the estimate of the entropy is computed per
\[H_{est} = -\sum_{i=1}^kf(x_i)ln(f(x_i)) + ln(w) - bias w = \frac{bin_{max} - bin_{min}}{n_{bins}} bias = -\frac{n_{bins} - 1}{2N}\]Because of the standardization before the histogram computation, the entropy estimate is scaled again per
\[H_{est} = exp(H_{est}^2) - 2\]References
[1]Wallis, Kenneth. “A note on the calculation of entropy from histograms”. 2006. https://warwick.ac.uk/fac/soc/economics/staff/academic/wallis/publications/entropy.pdf
- compute(signal, *, axis=-1)#
Compute the signal entropy
- Parameters:
- signalarray-like
Array-like containing values to compute the signal entropy for.
- axisint, optional
Axis along which the signal entropy will be computed. Ignored if signal is a pandas.DataFrame. Default is last (-1).
- Returns:
- sig_entnumpy.ndarray
Computed signal entropy.