dynsight.analysis.compute_kl_entropy_multi¶
- dynsight.analysis.compute_kl_entropy_multi(data, n_neigh=1, units='bit')[source]¶
Estimate Shannon differential entropy using Kozachenko-Leonenko.
This function works for multivariate distribution. The Kozachenko-Leonenko k-nearest neighbors method approximates differential entropy based on distances to nearest neighbors in the sample space. It’s main advantage is being parameter-free.
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]) – The dataset for which the entropy is to be computed. Shape (n_data, n_dims)
n_neigh (int) – The number of neighbors considered in the KL estimator.
units (Literal['bit', 'nat']) – The units of measure of the output entropy. If “bit”, it is computed with log base 2, if “nat” with natural log.
- Returns:
The Shannon differential entropy of the dataset, in bits.
- Return type:
Example
import numpy as np from dynsight.analysis import compute_kl_entropy_multi np.random.seed(1234) data = np.random.rand(10000, 2) data_entropy = compute_kl_entropy_multi(data)