dynsight.analysis.compute_shannon_multi¶
- dynsight.analysis.compute_shannon_multi(data, data_ranges, n_bins, units='frac')[source]¶
Compute the Shannon entropy of a multivariate data distribution.
It is normalized so that a uniform distribution has unitary entropy.
Deprecated since version v2025.08.27: This function is deprecated and will be removed after June 2026. Use
analysis.shannon()instead.- Parameters:
data (NDArray[np.float64]) – shape (n_samples, n_dimensions) The dataset for which the entropy is to be computed.
data_ranges (list[tuple[float, float]]) – A list of tuples [(min1, max1), (min2, max2), …] specifying the range over which the histogram must be computed for each dimension.
n_bins (list[int]) – A list of integers specifying the number of bins for each dimension.
units (Literal['bit', 'nat', 'frac']) – The units of measure of the output entropy. If “frac”, entropy is normalized between 0 and 1 by dividing by log(n_bins). If “bit”, it is computed with log base 2, if “nat” with natural log.
- Returns:
The value of the normalized Shannon entropy of the dataset.
- Return type:
Example
import numpy as np from dynsight.analysis import compute_shannon_multi np.random.seed(1234) data = np.random.rand(1000, 2) # 2D dataset data_ranges = [(0.0, 1.0), (0.0, 1.0)] n_bins = [40, 40] data_entropy = compute_shannon_multi( data, data_ranges, n_bins, )