KSGMIEstimator#
- class infomeasure.estimators.mutual_information.KSGMIEstimator(*data, cond=None, k: int = 4, ksg_id: int = 1, noise_level=1e-10, minkowski_p=inf, offset: int = 0, normalize: bool = False, base: int | float | str = 'e', **kwargs)[source]
Bases:
BaseKSGMIEstimator,MutualInformationEstimatorEstimator for mutual information using the Kraskov-Stoegbauer-Grassberger (KSG) method.
- Attributes:
- *dataarray_like,
shape(n_samples,) The data used to estimate the mutual information. You can pass an arbitrary number of data arrays as positional arguments.
- k
int The number of nearest neighbors to consider.
- noise_level
float The standard deviation of the Gaussian noise to add to the data to avoid issues with zero distances.
- minkowski_p
float, \(1 \leq p \leq \infty\) The power parameter for the Minkowski metric. Default is np.inf for maximum norm. Use 2 for Euclidean distance.
- offset
int,optional Number of positions to shift the data arrays relative to each other. Delay/lag/shift between the variables. Default is no shift.
- normalizebool,
optional If True, normalize the data before analysis.
- *dataarray_like,
Notes
The estimator supports two variants:
Type I (
ksg_id=1): Uses strict inequality for counting neighbors in marginal spaces (dist < eps).Type II (
ksg_id=2): Uses non-strict inequality (dist <= eps) and a modified formula.
Changing the number of nearest neighbors
kcan change the outcome, but the default value of \(k=4\) is recommended by [KSG11].