dynsight.analysis.compute_negentropy

dynsight.analysis.compute_negentropy(data, units='bit')[source]

Estimate negentropy of a dataset.

Negentropy is a measure of non-Gaussianity representing the distance from a Gaussian distribution; it’s used to quantify the amount of information in a signal, the Gaussian being the less informative distribution for a given variance.

\[Neg(X) = H(X_{Gauss}) - H(X)\]
Parameters:
  • data (NDArray[np.float64]) – The dataset for which the entropy is to be computed.

  • units (Literal['bit', 'nat']) – The units of measure of the output negentropy. If “bit”, it is computed with log base 2, if “nat” with natural log.

Returns:

The negentropy of the dataset.

Return type:

float

Example

import numpy as np
from dynsight.analysis import compute_negentropy

np.random.seed(1234)
data = np.random.rand(10000)

negentropy = compute_negentropy(data)