infomeasure.estimators.mutual_information package#
Submodules#
infomeasure.estimators.mutual_information.ansb module#
Module for the Ansb mutual information estimator.
- class infomeasure.estimators.mutual_information.ansb.AnsbCMIEstimator(*data, cond=None, undersampled: float = 0.1, offset: int = 0, base: int | float | str = 'e', **kwargs)[source]#
Bases:
BaseAnsbMIEstimator,ConditionalMutualInformationEstimatorEstimator for the conditional Ansb mutual information.
Ansb conditional mutual information estimator using the entropy combination formula.
- Attributes:
- *dataarray_like,
shape(n_samples,) The data used to estimate the conditional mutual information. You can pass an arbitrary number of data arrays as positional arguments.
- condarray_like
The conditional data used to estimate the conditional mutual information.
- undersampled
float, default=0.1 Maximum allowed ratio N/K to consider data sufficiently undersampled. A warning is issued if this threshold is exceeded.
- 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.
- *dataarray_like,
See also
infomeasure.estimators.entropy.ansb.AnsbEntropyEstimatorAnsb entropy estimator.
Notes
This estimator uses the Ansb entropy estimator to compute conditional mutual information through the entropy combination formula.
Note that the entropy combination formula is used (_generic_cmi_from_entropy) not a dedicated implementation as other MI might have.
- class infomeasure.estimators.mutual_information.ansb.AnsbMIEstimator(*data, cond=None, undersampled: float = 0.1, offset: int = 0, base: int | float | str = 'e', **kwargs)[source]#
Bases:
BaseAnsbMIEstimator,MutualInformationEstimatorEstimator for the Ansb mutual information.
Ansb mutual information estimator using the entropy combination formula.
- 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.
- undersampled
float, default=0.1 Maximum allowed ratio N/K to consider data sufficiently undersampled. A warning is issued if this threshold is exceeded.
- 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.
- *dataarray_like,
See also
infomeasure.estimators.entropy.ansb.AnsbEntropyEstimatorAnsb entropy estimator.
Notes
This estimator uses the Ansb entropy estimator to compute mutual information through the entropy combination formula.
Note that the entropy combination formula is used (_generic_mi_from_entropy) not a dedicated implementation as other MI might have.
- class infomeasure.estimators.mutual_information.ansb.BaseAnsbMIEstimator(*data, cond=None, undersampled: float = 0.1, offset: int = 0, base: int | float | str = 'e', **kwargs)[source]#
Bases:
ABCBase class for Ansb mutual information estimators.
- Attributes:
- *dataarray_like,
shape(n_samples,) The data used to estimate the (conditional) mutual information. You can pass an arbitrary number of data arrays as positional arguments. For conditional mutual information, only two data arrays are allowed.
- condarray_like,
optional The conditional data used to estimate the conditional mutual information.
- undersampled
float, default=0.1 Maximum allowed ratio N/K to consider data sufficiently undersampled. A warning is issued if this threshold is exceeded.
- 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. Not compatible with the
condparameter / conditional MI.
- *dataarray_like,
infomeasure.estimators.mutual_information.bayes module#
Module for the Bayes mutual information estimator.
- class infomeasure.estimators.mutual_information.bayes.BaseBayesMIEstimator(*data, cond=None, alpha: float | str, K: int = None, offset: int = 0, base: int | float | str = 'e', **kwargs)[source]#
Bases:
ABCBase class for Bayes mutual information estimators.
- Attributes:
- *dataarray_like,
shape(n_samples,) The data used to estimate the (conditional) mutual information. You can pass an arbitrary number of data arrays as positional arguments. For conditional mutual information, only two data arrays are allowed.
- condarray_like,
optional The conditional data used to estimate the conditional mutual information.
- alpha
float|str The concentration parameter α of the Dirichlet prior. Either a float or a string specifying the choice of concentration parameter.
- K
int,optional The support size. If not provided, uses the observed support size.
- 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. Not compatible with the
condparameter / conditional MI.
- *dataarray_like,
- class infomeasure.estimators.mutual_information.bayes.BayesCMIEstimator(*data, cond=None, alpha: float | str, K: int = None, offset: int = 0, base: int | float | str = 'e', **kwargs)[source]#
Bases:
BaseBayesMIEstimator,ConditionalMutualInformationEstimatorEstimator for the conditional Bayes mutual information.
Bayesian conditional mutual information estimator using Dirichlet prior with concentration parameter α. Provides principled handling of sparse data through Bayesian probability estimates.
- Attributes:
- *dataarray_like,
shape(n_samples,) The data used to estimate the conditional mutual information. You can pass an arbitrary number of data arrays as positional arguments.
- condarray_like
The conditional data used to estimate the conditional mutual information.
- alpha
float|str The concentration parameter α of the Dirichlet prior. Either a float or a string specifying the choice of concentration parameter.
- K
int,optional The support size. If not provided, uses the observed support size.
- 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.
- *dataarray_like,
See also
infomeasure.estimators.entropy.bayes.BayesEntropyEstimatorBayesian entropy estimator with Dirichlet prior.
Notes
This estimator uses Bayesian probability estimates with a Dirichlet prior to compute conditional mutual information through the entropy combination formula.
Note that the entropy combination formula is used (_generic_cmi_from_entropy) not a dedicated implementation as other MI might have.
- class infomeasure.estimators.mutual_information.bayes.BayesMIEstimator(*data, cond=None, alpha: float | str, K: int = None, offset: int = 0, base: int | float | str = 'e', **kwargs)[source]#
Bases:
BaseBayesMIEstimator,MutualInformationEstimatorEstimator for the Bayes mutual information.
Bayesian mutual information estimator using Dirichlet prior with concentration parameter α. Provides principled handling of sparse data through Bayesian probability estimates.
- 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.
- alpha
float|str The concentration parameter α of the Dirichlet prior. Either a float or a string specifying the choice of concentration parameter.
- K
int,optional The support size. If not provided, uses the observed support size.
- 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.
- *dataarray_like,
See also
infomeasure.estimators.entropy.bayes.BayesEntropyEstimatorBayesian entropy estimator with Dirichlet prior.
Notes
This estimator uses Bayesian probability estimates with a Dirichlet prior to compute mutual information through the entropy combination formula.
Note that the entropy combination formula is used (_generic_mi_from_entropy) not a dedicated implementation as other MI might have.
infomeasure.estimators.mutual_information.bonachela module#
Module for the Bonachela mutual information estimator.
- class infomeasure.estimators.mutual_information.bonachela.BaseBonachelaMIEstimator(*data, cond=None, offset: int = 0, base: int | float | str = 'e', **kwargs)[source]#
Bases:
ABCBase class for Bonachela mutual information estimators.
- Attributes:
- *dataarray_like,
shape(n_samples,) The data used to estimate the (conditional) mutual information. You can pass an arbitrary number of data arrays as positional arguments. For conditional mutual information, only two data arrays are allowed.
- condarray_like,
optional The conditional data used to estimate the conditional mutual information.
- 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. Not compatible with the
condparameter / conditional MI.
- *dataarray_like,
- class infomeasure.estimators.mutual_information.bonachela.BonachelaCMIEstimator(*data, cond=None, offset: int = 0, base: int | float | str = 'e', **kwargs)[source]#
Bases:
BaseBonachelaMIEstimator,ConditionalMutualInformationEstimatorEstimator for the conditional Bonachela mutual information.
Bonachela conditional mutual information estimator using the entropy combination formula.
- Attributes:
- *dataarray_like,
shape(n_samples,) The data used to estimate the conditional mutual information. You can pass an arbitrary number of data arrays as positional arguments.
- condarray_like
The conditional data used to estimate the conditional mutual information.
- 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.
- *dataarray_like,
See also
infomeasure.estimators.entropy.bonachela.BonachelaEntropyEstimatorBonachela entropy estimator.
Notes
This estimator uses the Bonachela entropy estimator to compute conditional mutual information through the entropy combination formula.
Note that the entropy combination formula is used (_generic_cmi_from_entropy) not a dedicated implementation as other MI might have.
- class infomeasure.estimators.mutual_information.bonachela.BonachelaMIEstimator(*data, cond=None, offset: int = 0, base: int | float | str = 'e', **kwargs)[source]#
Bases:
BaseBonachelaMIEstimator,MutualInformationEstimatorEstimator for the Bonachela mutual information.
Bonachela mutual information estimator using the entropy combination formula.
- 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.
- 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.
- *dataarray_like,
See also
infomeasure.estimators.entropy.bonachela.BonachelaEntropyEstimatorBonachela entropy estimator.
Notes
This estimator uses the Bonachela entropy estimator to compute mutual information through the entropy combination formula.
Note that the entropy combination formula is used (_generic_mi_from_entropy) not a dedicated implementation as other MI might have.
infomeasure.estimators.mutual_information.chao_shen module#
Module for the ChaoShen mutual information estimator.
- class infomeasure.estimators.mutual_information.chao_shen.BaseChaoShenMIEstimator(*data, cond=None, offset: int = 0, base: int | float | str = 'e', **kwargs)[source]#
Bases:
ABCBase class for ChaoShen mutual information estimators.
- Attributes:
- *dataarray_like,
shape(n_samples,) The data used to estimate the (conditional) mutual information. You can pass an arbitrary number of data arrays as positional arguments. For conditional mutual information, only two data arrays are allowed.
- condarray_like,
optional The conditional data used to estimate the conditional mutual information.
- 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. Not compatible with the
condparameter / conditional MI.
- *dataarray_like,
- class infomeasure.estimators.mutual_information.chao_shen.ChaoShenCMIEstimator(*data, cond=None, offset: int = 0, base: int | float | str = 'e', **kwargs)[source]#
Bases:
BaseChaoShenMIEstimator,ConditionalMutualInformationEstimatorEstimator for the conditional ChaoShen mutual information.
ChaoShen conditional mutual information estimator using the entropy combination formula.
- Attributes:
- *dataarray_like,
shape(n_samples,) The data used to estimate the conditional mutual information. You can pass an arbitrary number of data arrays as positional arguments.
- condarray_like
The conditional data used to estimate the conditional mutual information.
- 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.
- *dataarray_like,
See also
infomeasure.estimators.entropy.chao_shen.ChaoShenEntropyEstimatorChaoShen entropy estimator.
Notes
This estimator uses the ChaoShen entropy estimator to compute conditional mutual information through the entropy combination formula.
Note that the entropy combination formula is used (_generic_cmi_from_entropy) not a dedicated implementation as other MI might have.
- class infomeasure.estimators.mutual_information.chao_shen.ChaoShenMIEstimator(*data, cond=None, offset: int = 0, base: int | float | str = 'e', **kwargs)[source]#
Bases:
BaseChaoShenMIEstimator,MutualInformationEstimatorEstimator for the ChaoShen mutual information.
ChaoShen mutual information estimator using the entropy combination formula.
- 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.
- 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.
- *dataarray_like,
See also
infomeasure.estimators.entropy.chao_shen.ChaoShenEntropyEstimatorChaoShen entropy estimator.
Notes
This estimator uses the ChaoShen entropy estimator to compute mutual information through the entropy combination formula.
Note that the entropy combination formula is used (_generic_mi_from_entropy) not a dedicated implementation as other MI might have.
infomeasure.estimators.mutual_information.chao_wang_jost module#
Module for the ChaoWangJost mutual information estimator.
- class infomeasure.estimators.mutual_information.chao_wang_jost.BaseChaoWangJostMIEstimator(*data, cond=None, offset: int = 0, base: int | float | str = 'e', **kwargs)[source]#
Bases:
ABCBase class for ChaoWangJost mutual information estimators.
- Attributes:
- *dataarray_like,
shape(n_samples,) The data used to estimate the (conditional) mutual information. You can pass an arbitrary number of data arrays as positional arguments. For conditional mutual information, only two data arrays are allowed.
- condarray_like,
optional The conditional data used to estimate the conditional mutual information.
- 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. Not compatible with the
condparameter / conditional MI.
- *dataarray_like,
- class infomeasure.estimators.mutual_information.chao_wang_jost.ChaoWangJostCMIEstimator(*data, cond=None, offset: int = 0, base: int | float | str = 'e', **kwargs)[source]#
Bases:
BaseChaoWangJostMIEstimator,ConditionalMutualInformationEstimatorEstimator for the conditional ChaoWangJost mutual information.
ChaoWangJost conditional mutual information estimator using the entropy combination formula.
- Attributes:
- *dataarray_like,
shape(n_samples,) The data used to estimate the conditional mutual information. You can pass an arbitrary number of data arrays as positional arguments.
- condarray_like
The conditional data used to estimate the conditional mutual information.
- 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.
- *dataarray_like,
See also
infomeasure.estimators.entropy.chao_wang_jost.ChaoWangJostEntropyEstimatorChaoWangJost entropy estimator.
Notes
This estimator uses the ChaoWangJost entropy estimator to compute conditional mutual information through the entropy combination formula.
Note that the entropy combination formula is used (_generic_cmi_from_entropy) not a dedicated implementation as other MI might have.
- class infomeasure.estimators.mutual_information.chao_wang_jost.ChaoWangJostMIEstimator(*data, cond=None, offset: int = 0, base: int | float | str = 'e', **kwargs)[source]#
Bases:
BaseChaoWangJostMIEstimator,MutualInformationEstimatorEstimator for the ChaoWangJost mutual information.
ChaoWangJost mutual information estimator using the entropy combination formula.
- 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.
- 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.
- *dataarray_like,
See also
infomeasure.estimators.entropy.chao_wang_jost.ChaoWangJostEntropyEstimatorChaoWangJost entropy estimator.
Notes
This estimator uses the ChaoWangJost entropy estimator to compute mutual information through the entropy combination formula.
Note that the entropy combination formula is used (_generic_mi_from_entropy) not a dedicated implementation as other MI might have.
infomeasure.estimators.mutual_information.discrete module#
Module for the discrete mutual information estimator.
- class infomeasure.estimators.mutual_information.discrete.BaseDiscreteMIEstimator(*data, cond=None, offset: int = 0, base: int | float | str = 'e', **kwargs)[source]#
Bases:
DiscreteMIMixin,ABCBase class for discrete mutual information estimators.
- Attributes:
- *dataarray_like,
shape(n_samples,) The data used to estimate the (conditional) mutual information. You can pass an arbitrary number of data arrays as positional arguments. For conditional mutual information, only two data arrays are allowed.
- condarray_like or
tupleofarray_like,optional The conditional data used to estimate the conditional mutual information. Multiple RVs can be passed as tuples and will be treated as joint distributions.
- 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. Not compatible with the
condparameter / conditional MI.
- *dataarray_like,
- class infomeasure.estimators.mutual_information.discrete.DiscreteCMIEstimator(*data, cond=None, offset: int = 0, base: int | float | str = 'e', **kwargs)[source]#
Bases:
BaseDiscreteMIEstimator,ConditionalMutualInformationEstimatorEstimator for the discrete conditional mutual information.
- Attributes:
- *dataarray_like,
shape(n_samples,) The data used to estimate the conditional mutual information. You can pass an arbitrary number of data arrays as positional arguments.
- condarray_like
The conditional data used to estimate the conditional mutual information.
- *dataarray_like,
- class infomeasure.estimators.mutual_information.discrete.DiscreteMIEstimator(*data, cond=None, offset: int = 0, base: int | float | str = 'e', **kwargs)[source]#
Bases:
BaseDiscreteMIEstimator,MutualInformationEstimatorEstimator for the discrete mutual information.
- 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.
- 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.
- *dataarray_like,
infomeasure.estimators.mutual_information.grassberger module#
Module for the Grassberger mutual information estimator.
- class infomeasure.estimators.mutual_information.grassberger.BaseGrassbergerMIEstimator(*data, cond=None, offset: int = 0, base: int | float | str = 'e', **kwargs)[source]#
Bases:
ABCBase class for Grassberger mutual information estimators.
- Attributes:
- *dataarray_like,
shape(n_samples,) The data used to estimate the (conditional) mutual information. You can pass an arbitrary number of data arrays as positional arguments. For conditional mutual information, only two data arrays are allowed.
- condarray_like,
optional The conditional data used to estimate the conditional mutual information.
- 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. Not compatible with the
condparameter / conditional MI.
- *dataarray_like,
- class infomeasure.estimators.mutual_information.grassberger.GrassbergerCMIEstimator(*data, cond=None, offset: int = 0, base: int | float | str = 'e', **kwargs)[source]#
Bases:
BaseGrassbergerMIEstimator,ConditionalMutualInformationEstimatorEstimator for the conditional Grassberger mutual information.
Grassberger conditional mutual information estimator using the entropy combination formula.
- Attributes:
- *dataarray_like,
shape(n_samples,) The data used to estimate the conditional mutual information. You can pass an arbitrary number of data arrays as positional arguments.
- condarray_like
The conditional data used to estimate the conditional mutual information.
- 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.
- *dataarray_like,
See also
infomeasure.estimators.entropy.grassberger.GrassbergerEntropyEstimatorGrassberger entropy estimator.
Notes
This estimator uses the Grassberger entropy estimator to compute conditional mutual information through the entropy combination formula.
Note that the entropy combination formula is used (_generic_cmi_from_entropy) not a dedicated implementation as other MI might have.
- class infomeasure.estimators.mutual_information.grassberger.GrassbergerMIEstimator(*data, cond=None, offset: int = 0, base: int | float | str = 'e', **kwargs)[source]#
Bases:
BaseGrassbergerMIEstimator,MutualInformationEstimatorEstimator for the Grassberger mutual information.
Grassberger mutual information estimator using the entropy combination formula.
- 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.
- 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.
- *dataarray_like,
See also
infomeasure.estimators.entropy.grassberger.GrassbergerEntropyEstimatorGrassberger entropy estimator.
Notes
This estimator uses the Grassberger entropy estimator to compute mutual information through the entropy combination formula.
Note that the entropy combination formula is used (_generic_mi_from_entropy) not a dedicated implementation as other MI might have.
infomeasure.estimators.mutual_information.kernel module#
Module for the kernel-based mutual information estimator.
- class infomeasure.estimators.mutual_information.kernel.BaseKernelMIEstimator(*data, cond=None, bandwidth: float | int = None, kernel: str = None, offset: int = 0, workers: int = 1, normalize: bool = False, base: int | float | str = 'e', **kwargs)[source]#
Bases:
WorkersMixin,ABCBase class for mutual information using Kernel Density Estimation (KDE).
- Attributes:
- *dataarray_like,
shape(n_samples,) The data used to estimate the (conditional) mutual information. You can pass an arbitrary number of data arrays as positional arguments. For conditional mutual information, only two data arrays are allowed.
- condarray_like,
optional The conditional data used to estimate the conditional mutual information.
- bandwidth
float|int The bandwidth for the kernel.
- kernel
str Type of kernel to use, compatible with the KDE implementation
kde_probability_density_function().- 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. Not compatible with the
condparameter / conditional MI.- normalizebool,
optional If True, normalize the data before analysis.
- workers
int,optional Number of workers to use for parallel processing. Default is 1, meaning no parallel processing. If set to -1, all available CPU cores will be used.
- *dataarray_like,
- class infomeasure.estimators.mutual_information.kernel.KernelCMIEstimator(*data, cond=None, bandwidth: float | int = None, kernel: str = None, offset: int = 0, workers: int = 1, normalize: bool = False, base: int | float | str = 'e', **kwargs)[source]#
Bases:
BaseKernelMIEstimator,ConditionalMutualInformationEstimatorEstimator for conditional mutual information using Kernel Density Estimation (KDE).
\[I(X;Y|Z) = \sum_{i=1}^{n} p(x_i, y_i, z_i) \log \left( \frac{p(z_i)p(x_i, y_i, z_i)}{p(x_i, z_i)p(y_i, z_i)} \right)\]- Attributes:
- *dataarray_like,
shape(n_samples,) The data used to estimate the conditional mutual information. You can pass an arbitrary number of data arrays as positional arguments.
- condarray_like
The conditional data used to estimate the conditional mutual information.
- bandwidth
float|int The bandwidth for the kernel.
- kernel
str Type of kernel to use, compatible with the KDE implementation
kde_probability_density_function().- normalizebool,
optional If True, normalize the data before analysis.
- *dataarray_like,
Notes
A small
bandwidthcan lead to under-sampling, while a largebandwidthmay over-smooth the data, obscuring details.
- class infomeasure.estimators.mutual_information.kernel.KernelMIEstimator(*data, cond=None, bandwidth: float | int = None, kernel: str = None, offset: int = 0, workers: int = 1, normalize: bool = False, base: int | float | str = 'e', **kwargs)[source]#
Bases:
BaseKernelMIEstimator,MutualInformationEstimatorEstimator for mutual information using Kernel Density Estimation (KDE).
\[I(X;Y) = \sum_{i=1}^{n} p(x_i, y_i) \log \left( \frac{p(x_i, y_i)}{p(x_i)p(y_i)} \right)\]- 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.
- bandwidth
float|int The bandwidth for the kernel.
- kernel
str Type of kernel to use, compatible with the KDE implementation
kde_probability_density_function().- 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
A small
bandwidthcan lead to under-sampling, while a largebandwidthmay over-smooth the data, obscuring details.
infomeasure.estimators.mutual_information.kraskov_stoegbauer_grassberger module#
Module for the Kraskov-Stoegbauer-Grassberger (KSG) mutual information estimator.
- class infomeasure.estimators.mutual_information.kraskov_stoegbauer_grassberger.BaseKSGMIEstimator(*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:
ABCBase class for mutual information using the Kraskov-Stoegbauer-Grassberger (KSG) method.
- Attributes:
- *dataarray_like,
shape(n_samples,) The data used to estimate the (conditional) mutual information. You can pass an arbitrary number of data arrays as positional arguments. For conditional mutual information, only two data arrays are allowed.
- condarray_like,
optional The conditional data used to estimate the conditional mutual information.
- 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.
- ksg_id
int, default=1 The KSG estimator variant to use (1 or 2). Type I uses strict inequality for neighbor counting and the corresponding formula. Type II uses non-strict inequality and a different formula.
- 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. Not compatible with the
condparameter / conditional MI.- normalizebool,
optional If True, normalize the data before analysis.
- *dataarray_like,
- class infomeasure.estimators.mutual_information.kraskov_stoegbauer_grassberger.KSGCMIEstimator(*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,ConditionalMutualInformationEstimatorEstimator for conditional mutual information using the Kraskov-Stoegbauer-Grassberger (KSG) method.
- Attributes:
- *dataarray_like,
shape(n_samples,) The data used to estimate the conditional mutual information. You can pass an arbitrary number of data arrays as positional arguments.
- condarray_like
The conditional data used to estimate the conditional mutual information.
- 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.
- normalizebool,
optional If True, normalize the data before analysis.
- *dataarray_like,
Notes
Changing the number of nearest neighbors
kcan change the outcome, but the default value of \(k=4\) is recommended by [KSG11].
- class infomeasure.estimators.mutual_information.kraskov_stoegbauer_grassberger.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].
infomeasure.estimators.mutual_information.miller_madow module#
Module for the discrete Miller-Madow mutual information estimator.
- class infomeasure.estimators.mutual_information.miller_madow.BaseMillerMadowMIEstimator(*data, cond=None, offset: int = 0, base: int | float | str = 'e', **kwargs)[source]#
Bases:
DiscreteMIMixin,ABCBase class for discrete Miller-Madow mutual information estimators.
- Attributes:
- *dataarray_like,
shape(n_samples,) The data used to estimate the (conditional) mutual information. You can pass an arbitrary number of data arrays as positional arguments. For conditional mutual information, only two data arrays are allowed.
- condarray_like,
optional The conditional data used to estimate the conditional mutual information.
- 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. Not compatible with the
condparameter / conditional MI.
- *dataarray_like,
- class infomeasure.estimators.mutual_information.miller_madow.MillerMadowCMIEstimator(*data, cond=None, offset: int = 0, base: int | float | str = 'e', **kwargs)[source]#
Bases:
BaseMillerMadowMIEstimator,ConditionalMutualInformationEstimatorEstimator for the discrete Miller-Madow conditional mutual information.
\[\begin{align} \hat{I}_{\tiny{MM}}(X_1; X_2; \ldots; X_n \mid Z)&= \hat{I}_{\tiny{MLE}}(\dots) + \frac{\left(\sum_{i=1}^{n}K_{iZ}-1\right) - \left(K_{1,\dots,i,Z}-1\right) - \left(K_{Z}-1\right)}{2N \cdot \log(\texttt{base})} \end{align}\]\(\hat{I}_{\tiny{MLE}}(X_1; \dots; X_n \mid Z)\) is the initial
DiscreteCMIEstimatorestimate, \(K_{iZ}\) is the number of unique values in the i-th variable joint with Z, \(K_{1,\dots,i,Z}\) is the number of unique joint values, \(K_Z\) is the number of unique values in the Z variable, and \(N\) is the number of samples.- Attributes:
- *dataarray_like,
shape(n_samples,) The data used to estimate the conditional mutual information. You can pass an arbitrary number of data arrays as positional arguments.
- condarray_like
The conditional data used to estimate the conditional mutual information.
- *dataarray_like,
- class infomeasure.estimators.mutual_information.miller_madow.MillerMadowMIEstimator(*data, cond=None, offset: int = 0, base: int | float | str = 'e', **kwargs)[source]#
Bases:
BaseMillerMadowMIEstimator,MutualInformationEstimatorEstimator for the discrete Miller-Madow mutual information.
\[\begin{split}\begin{align}\hat{I}_{\tiny{MM}}(X; Y) &= \hat{H}_{\tiny{MM}}(X) + \hat{H}_{\tiny{MM}}(Y) - \hat{H}_{\tiny{MM}}(X, Y)\\ &= \hat{H}_{\tiny{MLE}}(X) + \hat{H}_{\tiny{MLE}}(Y) - \hat{H}_{\tiny{MLE}}(X, Y) + (K_X + K_Y - K_{XY} - 1)/(2N \cdot \log(\texttt{base}))\\ &= \hat{I}_{\tiny{MLE}}(X; Y) + (K_X + K_Y - K_{XY} - 1)/(2N \cdot \log(\texttt{base}))\\ \end{align}\end{split}\]For an arbitrary number of random variables this is equivalent to:
\[\begin{align}\hat{I}_{\tiny{MM}}(X_1; \dots; X_n) &= \hat{I}_{\tiny{MLE}}(X_1; \dots; X_n) + \frac{\left(\sum_{i=1}^{n}K_i-1\right) - \left(K_{1,\dots,i}-1\right)}{2N \cdot \log(\texttt{base})} \end{align}\]\(\hat{I}_{\tiny{MLE}}(X_1; \dots; X_n)\) is the initial
DiscreteMIEstimatorestimate, \(K_i\) is the number of unique values in the i-th variable, \(K_{1,\dots,i}\) is the number of unique joint values, and \(N\) is the number of samples.- 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.
- 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.
- *dataarray_like,
infomeasure.estimators.mutual_information.nsb module#
Module for the Nsb mutual information estimator.
- class infomeasure.estimators.mutual_information.nsb.BaseNsbMIEstimator(*data, cond=None, K: int = None, offset: int = 0, base: int | float | str = 'e', **kwargs)[source]#
Bases:
ABCBase class for Nsb mutual information estimators.
- Attributes:
- *dataarray_like,
shape(n_samples,) The data used to estimate the (conditional) mutual information. You can pass an arbitrary number of data arrays as positional arguments. For conditional mutual information, only two data arrays are allowed.
- condarray_like,
optional The conditional data used to estimate the conditional mutual information.
- K
int,optional The support size. If not provided, uses the observed support size.
- 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. Not compatible with the
condparameter / conditional MI.
- *dataarray_like,
- class infomeasure.estimators.mutual_information.nsb.NsbCMIEstimator(*data, cond=None, K: int = None, offset: int = 0, base: int | float | str = 'e', **kwargs)[source]#
Bases:
BaseNsbMIEstimator,ConditionalMutualInformationEstimatorEstimator for the conditional Nsb mutual information.
Nsb conditional mutual information estimator using the entropy combination formula.
- Attributes:
- *dataarray_like,
shape(n_samples,) The data used to estimate the conditional mutual information. You can pass an arbitrary number of data arrays as positional arguments.
- condarray_like
The conditional data used to estimate the conditional mutual information.
- K
int,optional The support size. If not provided, uses the observed support size.
- 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.
- *dataarray_like,
See also
infomeasure.estimators.entropy.nsb.NsbEntropyEstimatorNsb entropy estimator.
Notes
This estimator uses the Nsb entropy estimator to compute conditional mutual information through the entropy combination formula.
Note that the entropy combination formula is used (_generic_cmi_from_entropy) not a dedicated implementation as other MI might have.
- class infomeasure.estimators.mutual_information.nsb.NsbMIEstimator(*data, cond=None, K: int = None, offset: int = 0, base: int | float | str = 'e', **kwargs)[source]#
Bases:
BaseNsbMIEstimator,MutualInformationEstimatorEstimator for the Nsb mutual information.
Nsb mutual information estimator using the entropy combination formula.
- 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,optional The support size. If not provided, uses the observed support size.
- 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.
- *dataarray_like,
See also
infomeasure.estimators.entropy.nsb.NsbEntropyEstimatorNsb entropy estimator.
Notes
This estimator uses the Nsb entropy estimator to compute mutual information through the entropy combination formula.
Note that the entropy combination formula is used (_generic_mi_from_entropy) not a dedicated implementation as other MI might have.
infomeasure.estimators.mutual_information.ordinal module#
Module for the Ordinal / Permutation mutual information estimator.
- class infomeasure.estimators.mutual_information.ordinal.BaseOrdinalMIEstimator(*data, cond=None, embedding_dim: int = None, step_size: int = 1, stable: bool = False, offset: int = 0, base: int | float | str = 'e', **kwargs)[source]#
Bases:
ABCBase class for the Ordinal mutual information.
- Attributes:
- *dataarray_like,
shape(n_samples,) The data used to estimate the (conditional) mutual information. You can pass an arbitrary number of data arrays as positional arguments. For conditional mutual information, only two data arrays are allowed.
- condarray_like,
optional The conditional data used to estimate the conditional mutual information.
- embedding_dim
int The size of the permutation patterns.
- step_size
int,optional Step size between elements for the state space reconstruction (delay).
- stablebool,
optional If True, when sorting the data, the order of equal elements is preserved. This can be useful for reproducibility and testing, but might be slower.
- 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. Not compatible with the
condparameter / conditional MI.- *symbolsarray_like,
shape(n_samples,) The symbolized data used to estimate the mutual information.
- *dataarray_like,
- Raises:
ValueErrorIf the
embedding_dimis negative or not an integer.ValueErrorIf
offsetandembedding_dimare such that the data is too small.TypeErrorIf the data are not 1d array-like(s).
Notes
The ordinality will be determined via
numpy.argsort(). There is nonormalizeoption, as this would not influence the order of the data.If
embedding_dimis set to 1, the mutual information is always 0.
- class infomeasure.estimators.mutual_information.ordinal.OrdinalCMIEstimator(*data, cond=None, embedding_dim: int = None, step_size: int = 1, stable: bool = False, offset: int = 0, base: int | float | str = 'e', **kwargs)[source]#
Bases:
BaseOrdinalMIEstimator,ConditionalMutualInformationEstimatorEstimator for the Ordinal conditional mutual information.
- Attributes:
- *dataarray_like,
shape(n_samples,) The data used to estimate the conditional mutual information. You can pass an arbitrary number of data arrays as positional arguments.
- condarray_like
The conditional data used to estimate the conditional mutual information.
- embedding_dim
int The size of the permutation patterns.
- *symbolsarray_like,
shape(n_samples,) The symbolized data used to estimate the mutual information.
- symbols_condarray_like,
shape(n_samples,) The symbolized conditional data used to estimate the conditional mutual information.
- *dataarray_like,
- Raises:
ValueErrorIf the
embedding_dimis negative or not an integer.ValueErrorIf
offsetandembedding_dimare such that the data is too small.
Notes
The order will be determined via
numpy.argsort(). There is nonormalizeoption, as this would not influence the order of the data.If
embedding_dimis set to 1, the mutual information is always 0.
- class infomeasure.estimators.mutual_information.ordinal.OrdinalMIEstimator(*data, cond=None, embedding_dim: int = None, step_size: int = 1, stable: bool = False, offset: int = 0, base: int | float | str = 'e', **kwargs)[source]#
Bases:
BaseOrdinalMIEstimator,MutualInformationEstimatorEstimator for the Ordinal mutual information.
- 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.
- embedding_dim
int The size of the permutation patterns.
- 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.
- *symbolsarray_like,
shape(n_samples,) The symbolized data used to estimate the mutual information.
- *dataarray_like,
- Raises:
-
ValueErrorIf the
embedding_dimis negative or not an integer.ValueErrorIf
offsetandembedding_dimare such that the data is too small.
Notes
The ordinality will be determined via
numpy.argsort(). There is nonormalizeoption, as this would not influence the order of the data.If
embedding_dimis set to 1, the mutual information is always 0.
infomeasure.estimators.mutual_information.renyi module#
Module for the Renyi mutual information estimator.
- class infomeasure.estimators.mutual_information.renyi.BaseRenyiMIEstimator(*data, cond=None, k: int = 4, alpha: float | int = None, noise_level=1e-08, offset: int = 0, normalize: bool = False, base: int | float | str = 'e', **kwargs)[source]#
Bases:
ABCBase class for Renyi mutual information estimators.
- Attributes:
- *dataarray_like,
shape(n_samples,) The data used to estimate the (conditional) mutual information. You can pass an arbitrary number of data arrays as positional arguments. For conditional mutual information, only two data arrays are allowed.
- condarray_like,
optional The conditional data used to estimate the conditional mutual information.
- k
int The number of nearest neighbors used in the estimation.
- alpha
float|int The Rényi parameter, order or exponent. Sometimes denoted as \(\alpha\) or \(q\).
- noise_level
float The standard deviation of the Gaussian noise to add to the data to avoid issues with zero distances.
- 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. Not compatible with the
condparameter / conditional MI.- normalizebool,
optional If True, normalize the data before analysis.
- *dataarray_like,
- class infomeasure.estimators.mutual_information.renyi.RenyiCMIEstimator(*data, cond=None, k: int = 4, alpha: float | int = None, noise_level=1e-08, offset: int = 0, normalize: bool = False, base: int | float | str = 'e', **kwargs)[source]#
Bases:
BaseRenyiMIEstimator,ConditionalMutualInformationEstimatorEstimator for the conditional Renyi mutual information.
- Attributes:
- *dataarray_like,
shape(n_samples,) The data used to estimate the conditional mutual information. You can pass an arbitrary number of data arrays as positional arguments.
- condarray_like
The conditional data used to estimate the conditional mutual information.
- k
int The number of nearest neighbors used in the estimation.
- alpha
float|int The Rényi parameter, order or exponent. Sometimes denoted as \(\alpha\) or \(q\).
- noise_level
float The standard deviation of the Gaussian noise to add to the data to avoid issues with zero distances.
- 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 Rényi entropy is a generalization of Shannon entropy, where the small values of probabilities are emphasized for \(\alpha < 1\), and higher probabilities are emphasized for \(\alpha > 1\). For \(\alpha = 1\), it reduces to Shannon entropy. The Rényi-Entropy class can be particularly interesting for systems where additivity (in Shannon sense) is not always preserved, especially in nonlinear complex systems, such as when dealing with long-range forces.
- class infomeasure.estimators.mutual_information.renyi.RenyiMIEstimator(*data, cond=None, k: int = 4, alpha: float | int = None, noise_level=1e-08, offset: int = 0, normalize: bool = False, base: int | float | str = 'e', **kwargs)[source]#
Bases:
BaseRenyiMIEstimator,MutualInformationEstimatorEstimator for the Renyi mutual information.
- 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 used in the estimation.
- alpha
float|int The Rényi parameter, order or exponent. Sometimes denoted as \(\alpha\) or \(q\).
- noise_level
float The standard deviation of the Gaussian noise to add to the data to avoid issues with zero distances.
- 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 Rényi entropy is a generalization of Shannon entropy, where the small values of probabilities are emphasized for \(\alpha < 1\), and higher probabilities are emphasized for \(\alpha > 1\). For \(\alpha = 1\), it reduces to Shannon entropy. The Rényi-Entropy class can be particularly interesting for systems where additivity (in Shannon sense) is not always preserved, especially in nonlinear complex systems, such as when dealing with long-range forces.
infomeasure.estimators.mutual_information.shrink module#
Module for the Shrink mutual information estimator.
- class infomeasure.estimators.mutual_information.shrink.BaseShrinkMIEstimator(*data, cond=None, offset: int = 0, base: int | float | str = 'e', **kwargs)[source]#
Bases:
ABCBase class for Shrink mutual information estimators.
- Attributes:
- *dataarray_like,
shape(n_samples,) The data used to estimate the (conditional) mutual information. You can pass an arbitrary number of data arrays as positional arguments. For conditional mutual information, only two data arrays are allowed.
- condarray_like,
optional The conditional data used to estimate the conditional mutual information.
- 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. Not compatible with the
condparameter / conditional MI.
- *dataarray_like,
- class infomeasure.estimators.mutual_information.shrink.ShrinkCMIEstimator(*data, cond=None, offset: int = 0, base: int | float | str = 'e', **kwargs)[source]#
Bases:
BaseShrinkMIEstimator,ConditionalMutualInformationEstimatorEstimator for the conditional Shrink mutual information.
Shrink conditional mutual information estimator using the entropy combination formula.
- Attributes:
- *dataarray_like,
shape(n_samples,) The data used to estimate the conditional mutual information. You can pass an arbitrary number of data arrays as positional arguments.
- condarray_like
The conditional data used to estimate the conditional mutual information.
- 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.
- *dataarray_like,
See also
infomeasure.estimators.entropy.shrink.ShrinkEntropyEstimatorShrink entropy estimator.
Notes
This estimator uses the Shrink entropy estimator to compute conditional mutual information through the entropy combination formula.
Note that the entropy combination formula is used (_generic_cmi_from_entropy) not a dedicated implementation as other MI might have.
- class infomeasure.estimators.mutual_information.shrink.ShrinkMIEstimator(*data, cond=None, offset: int = 0, base: int | float | str = 'e', **kwargs)[source]#
Bases:
BaseShrinkMIEstimator,MutualInformationEstimatorEstimator for the Shrink mutual information.
Shrink mutual information estimator using the entropy combination formula.
- 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.
- 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.
- *dataarray_like,
See also
infomeasure.estimators.entropy.shrink.ShrinkEntropyEstimatorShrink entropy estimator.
Notes
This estimator uses the Shrink entropy estimator to compute mutual information through the entropy combination formula.
Note that the entropy combination formula is used (_generic_mi_from_entropy) not a dedicated implementation as other MI might have.
infomeasure.estimators.mutual_information.tsallis module#
Module for the Tsallis mutual information estimator.
- class infomeasure.estimators.mutual_information.tsallis.BaseTsallisMIEstimator(*data, cond=None, k: int = 4, q: float | int = None, noise_level: float = 1e-08, offset: int = 0, normalize: bool = False, base: int | float | str = 'e', **kwargs)[source]#
Bases:
ABCBase class for Tsallis mutual information estimators.
- Attributes:
- *dataarray_like,
shape(n_samples,) The data used to estimate the (conditional) mutual information. You can pass an arbitrary number of data arrays as positional arguments. For conditional mutual information, only two data arrays are allowed.
- condarray_like,
optional The conditional data used to estimate the conditional mutual information.
- k
int The number of nearest neighbors used in the estimation.
- q
float The Tsallis parameter, order or exponent. Sometimes denoted as \(q\), analogous to the Rényi parameter \(\alpha\).
- noise_level
float The standard deviation of the Gaussian noise to add to the data to avoid issues with zero distances.
- 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. Not compatible with the
condparameter / conditional MI.- normalizebool,
optional If True, normalize the data before analysis.
- *dataarray_like,
- class infomeasure.estimators.mutual_information.tsallis.TsallisCMIEstimator(*data, cond=None, k: int = 4, q: float | int = None, noise_level: float = 1e-08, offset: int = 0, normalize: bool = False, base: int | float | str = 'e', **kwargs)[source]#
Bases:
BaseTsallisMIEstimator,ConditionalMutualInformationEstimatorEstimator for the conditional Tsallis mutual information.
- Parameters:
- *dataarray_like,
shape(n_samples,) The data used to estimate the conditional mutual information. You can pass an arbitrary number of data arrays as positional arguments.
- condarray_like
The conditional data used to estimate the conditional mutual information.
- k
int The number of nearest neighbors to consider.
- q
float|int The Tsallis parameter, order or exponent. Sometimes denoted as \(q\), analogous to the Rényi parameter \(\alpha\).
- noise_level
float The standard deviation of the Gaussian noise to add to the data to avoid issues with zero distances.
- normalize
If True, normalize the data before analysis.
- *dataarray_like,
Notes
In the \(q \to 1\) limit, the Jackson sum (q-additivity) reduces to ordinary summation, and the Tallis entropy reduces to Shannon Entropy. This class of entropy measure is in particularly useful in the study in connection with long-range correlated systems and with non-equilibrium phenomena.
- class infomeasure.estimators.mutual_information.tsallis.TsallisMIEstimator(*data, cond=None, k: int = 4, q: float | int = None, noise_level: float = 1e-08, offset: int = 0, normalize: bool = False, base: int | float | str = 'e', **kwargs)[source]#
Bases:
BaseTsallisMIEstimator,MutualInformationEstimatorEstimator for the Tsallis mutual information.
- 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 used in the estimation.
- q
float The Tsallis parameter, order or exponent. Sometimes denoted as \(q\), analogous to the Rényi parameter \(\alpha\).
- noise_level
float The standard deviation of the Gaussian noise to add to the data to avoid issues with zero distances.
- 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
In the \(q \to 1\) limit, the Jackson sum (q-additivity) reduces to ordinary summation, and the Tallis entropy reduces to Shannon Entropy. This class of entropy measure is in particularly useful in the study in connection with long-range correlated systems and with non-equilibrium phenomena.
infomeasure.estimators.mutual_information.zhang module#
Module for the Zhang mutual information estimator.
- class infomeasure.estimators.mutual_information.zhang.BaseZhangMIEstimator(*data, cond=None, offset: int = 0, base: int | float | str = 'e', **kwargs)[source]#
Bases:
ABCBase class for Zhang mutual information estimators.
- Attributes:
- *dataarray_like,
shape(n_samples,) The data used to estimate the (conditional) mutual information. You can pass an arbitrary number of data arrays as positional arguments. For conditional mutual information, only two data arrays are allowed.
- condarray_like,
optional The conditional data used to estimate the conditional mutual information.
- 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. Not compatible with the
condparameter / conditional MI.
- *dataarray_like,
- class infomeasure.estimators.mutual_information.zhang.ZhangCMIEstimator(*data, cond=None, offset: int = 0, base: int | float | str = 'e', **kwargs)[source]#
Bases:
BaseZhangMIEstimator,ConditionalMutualInformationEstimatorEstimator for the conditional Zhang mutual information.
Zhang conditional mutual information estimator using the entropy combination formula.
- Attributes:
- *dataarray_like,
shape(n_samples,) The data used to estimate the conditional mutual information. You can pass an arbitrary number of data arrays as positional arguments.
- condarray_like
The conditional data used to estimate the conditional mutual information.
- 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.
- *dataarray_like,
See also
infomeasure.estimators.entropy.zhang.ZhangEntropyEstimatorZhang entropy estimator.
Notes
This estimator uses the Zhang entropy estimator to compute conditional mutual information through the entropy combination formula.
Note that the entropy combination formula is used (_generic_cmi_from_entropy) not a dedicated implementation as other MI might have.
- class infomeasure.estimators.mutual_information.zhang.ZhangMIEstimator(*data, cond=None, offset: int = 0, base: int | float | str = 'e', **kwargs)[source]#
Bases:
BaseZhangMIEstimator,MutualInformationEstimatorEstimator for the Zhang mutual information.
Zhang mutual information estimator using the entropy combination formula.
- 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.
- 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.
- *dataarray_like,
See also
infomeasure.estimators.entropy.zhang.ZhangEntropyEstimatorZhang entropy estimator.
Notes
This estimator uses the Zhang entropy estimator to compute mutual information through the entropy combination formula.
Note that the entropy combination formula is used (_generic_mi_from_entropy) not a dedicated implementation as other MI might have.
Module contents#
Mutual information estimators.
- class infomeasure.estimators.mutual_information.AnsbCMIEstimator(*data, cond=None, undersampled: float = 0.1, offset: int = 0, base: int | float | str = 'e', **kwargs)[source]#
Bases:
BaseAnsbMIEstimator,ConditionalMutualInformationEstimatorEstimator for the conditional Ansb mutual information.
Ansb conditional mutual information estimator using the entropy combination formula.
- Attributes:
- *dataarray_like,
shape(n_samples,) The data used to estimate the conditional mutual information. You can pass an arbitrary number of data arrays as positional arguments.
- condarray_like
The conditional data used to estimate the conditional mutual information.
- undersampled
float, default=0.1 Maximum allowed ratio N/K to consider data sufficiently undersampled. A warning is issued if this threshold is exceeded.
- 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.
- *dataarray_like,
See also
infomeasure.estimators.entropy.ansb.AnsbEntropyEstimatorAnsb entropy estimator.
Notes
This estimator uses the Ansb entropy estimator to compute conditional mutual information through the entropy combination formula.
Note that the entropy combination formula is used (_generic_cmi_from_entropy) not a dedicated implementation as other MI might have.
- class infomeasure.estimators.mutual_information.AnsbMIEstimator(*data, cond=None, undersampled: float = 0.1, offset: int = 0, base: int | float | str = 'e', **kwargs)[source]#
Bases:
BaseAnsbMIEstimator,MutualInformationEstimatorEstimator for the Ansb mutual information.
Ansb mutual information estimator using the entropy combination formula.
- 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.
- undersampled
float, default=0.1 Maximum allowed ratio N/K to consider data sufficiently undersampled. A warning is issued if this threshold is exceeded.
- 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.
- *dataarray_like,
See also
infomeasure.estimators.entropy.ansb.AnsbEntropyEstimatorAnsb entropy estimator.
Notes
This estimator uses the Ansb entropy estimator to compute mutual information through the entropy combination formula.
Note that the entropy combination formula is used (_generic_mi_from_entropy) not a dedicated implementation as other MI might have.
- class infomeasure.estimators.mutual_information.BayesCMIEstimator(*data, cond=None, alpha: float | str, K: int = None, offset: int = 0, base: int | float | str = 'e', **kwargs)[source]#
Bases:
BaseBayesMIEstimator,ConditionalMutualInformationEstimatorEstimator for the conditional Bayes mutual information.
Bayesian conditional mutual information estimator using Dirichlet prior with concentration parameter α. Provides principled handling of sparse data through Bayesian probability estimates.
- Attributes:
- *dataarray_like,
shape(n_samples,) The data used to estimate the conditional mutual information. You can pass an arbitrary number of data arrays as positional arguments.
- condarray_like
The conditional data used to estimate the conditional mutual information.
- alpha
float|str The concentration parameter α of the Dirichlet prior. Either a float or a string specifying the choice of concentration parameter.
- K
int,optional The support size. If not provided, uses the observed support size.
- 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.
- *dataarray_like,
See also
infomeasure.estimators.entropy.bayes.BayesEntropyEstimatorBayesian entropy estimator with Dirichlet prior.
Notes
This estimator uses Bayesian probability estimates with a Dirichlet prior to compute conditional mutual information through the entropy combination formula.
Note that the entropy combination formula is used (_generic_cmi_from_entropy) not a dedicated implementation as other MI might have.
- class infomeasure.estimators.mutual_information.BayesMIEstimator(*data, cond=None, alpha: float | str, K: int = None, offset: int = 0, base: int | float | str = 'e', **kwargs)[source]#
Bases:
BaseBayesMIEstimator,MutualInformationEstimatorEstimator for the Bayes mutual information.
Bayesian mutual information estimator using Dirichlet prior with concentration parameter α. Provides principled handling of sparse data through Bayesian probability estimates.
- 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.
- alpha
float|str The concentration parameter α of the Dirichlet prior. Either a float or a string specifying the choice of concentration parameter.
- K
int,optional The support size. If not provided, uses the observed support size.
- 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.
- *dataarray_like,
See also
infomeasure.estimators.entropy.bayes.BayesEntropyEstimatorBayesian entropy estimator with Dirichlet prior.
Notes
This estimator uses Bayesian probability estimates with a Dirichlet prior to compute mutual information through the entropy combination formula.
Note that the entropy combination formula is used (_generic_mi_from_entropy) not a dedicated implementation as other MI might have.
- class infomeasure.estimators.mutual_information.BonachelaCMIEstimator(*data, cond=None, offset: int = 0, base: int | float | str = 'e', **kwargs)[source]#
Bases:
BaseBonachelaMIEstimator,ConditionalMutualInformationEstimatorEstimator for the conditional Bonachela mutual information.
Bonachela conditional mutual information estimator using the entropy combination formula.
- Attributes:
- *dataarray_like,
shape(n_samples,) The data used to estimate the conditional mutual information. You can pass an arbitrary number of data arrays as positional arguments.
- condarray_like
The conditional data used to estimate the conditional mutual information.
- 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.
- *dataarray_like,
See also
infomeasure.estimators.entropy.bonachela.BonachelaEntropyEstimatorBonachela entropy estimator.
Notes
This estimator uses the Bonachela entropy estimator to compute conditional mutual information through the entropy combination formula.
Note that the entropy combination formula is used (_generic_cmi_from_entropy) not a dedicated implementation as other MI might have.
- class infomeasure.estimators.mutual_information.BonachelaMIEstimator(*data, cond=None, offset: int = 0, base: int | float | str = 'e', **kwargs)[source]#
Bases:
BaseBonachelaMIEstimator,MutualInformationEstimatorEstimator for the Bonachela mutual information.
Bonachela mutual information estimator using the entropy combination formula.
- 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.
- 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.
- *dataarray_like,
See also
infomeasure.estimators.entropy.bonachela.BonachelaEntropyEstimatorBonachela entropy estimator.
Notes
This estimator uses the Bonachela entropy estimator to compute mutual information through the entropy combination formula.
Note that the entropy combination formula is used (_generic_mi_from_entropy) not a dedicated implementation as other MI might have.
- class infomeasure.estimators.mutual_information.ChaoShenCMIEstimator(*data, cond=None, offset: int = 0, base: int | float | str = 'e', **kwargs)[source]#
Bases:
BaseChaoShenMIEstimator,ConditionalMutualInformationEstimatorEstimator for the conditional ChaoShen mutual information.
ChaoShen conditional mutual information estimator using the entropy combination formula.
- Attributes:
- *dataarray_like,
shape(n_samples,) The data used to estimate the conditional mutual information. You can pass an arbitrary number of data arrays as positional arguments.
- condarray_like
The conditional data used to estimate the conditional mutual information.
- 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.
- *dataarray_like,
See also
infomeasure.estimators.entropy.chao_shen.ChaoShenEntropyEstimatorChaoShen entropy estimator.
Notes
This estimator uses the ChaoShen entropy estimator to compute conditional mutual information through the entropy combination formula.
Note that the entropy combination formula is used (_generic_cmi_from_entropy) not a dedicated implementation as other MI might have.
- class infomeasure.estimators.mutual_information.ChaoShenMIEstimator(*data, cond=None, offset: int = 0, base: int | float | str = 'e', **kwargs)[source]#
Bases:
BaseChaoShenMIEstimator,MutualInformationEstimatorEstimator for the ChaoShen mutual information.
ChaoShen mutual information estimator using the entropy combination formula.
- 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.
- 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.
- *dataarray_like,
See also
infomeasure.estimators.entropy.chao_shen.ChaoShenEntropyEstimatorChaoShen entropy estimator.
Notes
This estimator uses the ChaoShen entropy estimator to compute mutual information through the entropy combination formula.
Note that the entropy combination formula is used (_generic_mi_from_entropy) not a dedicated implementation as other MI might have.
- class infomeasure.estimators.mutual_information.ChaoWangJostCMIEstimator(*data, cond=None, offset: int = 0, base: int | float | str = 'e', **kwargs)[source]#
Bases:
BaseChaoWangJostMIEstimator,ConditionalMutualInformationEstimatorEstimator for the conditional ChaoWangJost mutual information.
ChaoWangJost conditional mutual information estimator using the entropy combination formula.
- Attributes:
- *dataarray_like,
shape(n_samples,) The data used to estimate the conditional mutual information. You can pass an arbitrary number of data arrays as positional arguments.
- condarray_like
The conditional data used to estimate the conditional mutual information.
- 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.
- *dataarray_like,
See also
infomeasure.estimators.entropy.chao_wang_jost.ChaoWangJostEntropyEstimatorChaoWangJost entropy estimator.
Notes
This estimator uses the ChaoWangJost entropy estimator to compute conditional mutual information through the entropy combination formula.
Note that the entropy combination formula is used (_generic_cmi_from_entropy) not a dedicated implementation as other MI might have.
- class infomeasure.estimators.mutual_information.ChaoWangJostMIEstimator(*data, cond=None, offset: int = 0, base: int | float | str = 'e', **kwargs)[source]#
Bases:
BaseChaoWangJostMIEstimator,MutualInformationEstimatorEstimator for the ChaoWangJost mutual information.
ChaoWangJost mutual information estimator using the entropy combination formula.
- 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.
- 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.
- *dataarray_like,
See also
infomeasure.estimators.entropy.chao_wang_jost.ChaoWangJostEntropyEstimatorChaoWangJost entropy estimator.
Notes
This estimator uses the ChaoWangJost entropy estimator to compute mutual information through the entropy combination formula.
Note that the entropy combination formula is used (_generic_mi_from_entropy) not a dedicated implementation as other MI might have.
- class infomeasure.estimators.mutual_information.DiscreteCMIEstimator(*data, cond=None, offset: int = 0, base: int | float | str = 'e', **kwargs)[source]#
Bases:
BaseDiscreteMIEstimator,ConditionalMutualInformationEstimatorEstimator for the discrete conditional mutual information.
- Attributes:
- *dataarray_like,
shape(n_samples,) The data used to estimate the conditional mutual information. You can pass an arbitrary number of data arrays as positional arguments.
- condarray_like
The conditional data used to estimate the conditional mutual information.
- *dataarray_like,
- class infomeasure.estimators.mutual_information.DiscreteMIEstimator(*data, cond=None, offset: int = 0, base: int | float | str = 'e', **kwargs)[source]#
Bases:
BaseDiscreteMIEstimator,MutualInformationEstimatorEstimator for the discrete mutual information.
- 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.
- 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.
- *dataarray_like,
- class infomeasure.estimators.mutual_information.GrassbergerCMIEstimator(*data, cond=None, offset: int = 0, base: int | float | str = 'e', **kwargs)[source]#
Bases:
BaseGrassbergerMIEstimator,ConditionalMutualInformationEstimatorEstimator for the conditional Grassberger mutual information.
Grassberger conditional mutual information estimator using the entropy combination formula.
- Attributes:
- *dataarray_like,
shape(n_samples,) The data used to estimate the conditional mutual information. You can pass an arbitrary number of data arrays as positional arguments.
- condarray_like
The conditional data used to estimate the conditional mutual information.
- 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.
- *dataarray_like,
See also
infomeasure.estimators.entropy.grassberger.GrassbergerEntropyEstimatorGrassberger entropy estimator.
Notes
This estimator uses the Grassberger entropy estimator to compute conditional mutual information through the entropy combination formula.
Note that the entropy combination formula is used (_generic_cmi_from_entropy) not a dedicated implementation as other MI might have.
- class infomeasure.estimators.mutual_information.GrassbergerMIEstimator(*data, cond=None, offset: int = 0, base: int | float | str = 'e', **kwargs)[source]#
Bases:
BaseGrassbergerMIEstimator,MutualInformationEstimatorEstimator for the Grassberger mutual information.
Grassberger mutual information estimator using the entropy combination formula.
- 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.
- 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.
- *dataarray_like,
See also
infomeasure.estimators.entropy.grassberger.GrassbergerEntropyEstimatorGrassberger entropy estimator.
Notes
This estimator uses the Grassberger entropy estimator to compute mutual information through the entropy combination formula.
Note that the entropy combination formula is used (_generic_mi_from_entropy) not a dedicated implementation as other MI might have.
- class infomeasure.estimators.mutual_information.KSGCMIEstimator(*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,ConditionalMutualInformationEstimatorEstimator for conditional mutual information using the Kraskov-Stoegbauer-Grassberger (KSG) method.
- Attributes:
- *dataarray_like,
shape(n_samples,) The data used to estimate the conditional mutual information. You can pass an arbitrary number of data arrays as positional arguments.
- condarray_like
The conditional data used to estimate the conditional mutual information.
- 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.
- normalizebool,
optional If True, normalize the data before analysis.
- *dataarray_like,
Notes
Changing the number of nearest neighbors
kcan change the outcome, but the default value of \(k=4\) is recommended by [KSG11].
- 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].
- class infomeasure.estimators.mutual_information.KernelCMIEstimator(*data, cond=None, bandwidth: float | int = None, kernel: str = None, offset: int = 0, workers: int = 1, normalize: bool = False, base: int | float | str = 'e', **kwargs)[source]#
Bases:
BaseKernelMIEstimator,ConditionalMutualInformationEstimatorEstimator for conditional mutual information using Kernel Density Estimation (KDE).
\[I(X;Y|Z) = \sum_{i=1}^{n} p(x_i, y_i, z_i) \log \left( \frac{p(z_i)p(x_i, y_i, z_i)}{p(x_i, z_i)p(y_i, z_i)} \right)\]- Attributes:
- *dataarray_like,
shape(n_samples,) The data used to estimate the conditional mutual information. You can pass an arbitrary number of data arrays as positional arguments.
- condarray_like
The conditional data used to estimate the conditional mutual information.
- bandwidth
float|int The bandwidth for the kernel.
- kernel
str Type of kernel to use, compatible with the KDE implementation
kde_probability_density_function().- normalizebool,
optional If True, normalize the data before analysis.
- *dataarray_like,
Notes
A small
bandwidthcan lead to under-sampling, while a largebandwidthmay over-smooth the data, obscuring details.
- class infomeasure.estimators.mutual_information.KernelMIEstimator(*data, cond=None, bandwidth: float | int = None, kernel: str = None, offset: int = 0, workers: int = 1, normalize: bool = False, base: int | float | str = 'e', **kwargs)[source]#
Bases:
BaseKernelMIEstimator,MutualInformationEstimatorEstimator for mutual information using Kernel Density Estimation (KDE).
\[I(X;Y) = \sum_{i=1}^{n} p(x_i, y_i) \log \left( \frac{p(x_i, y_i)}{p(x_i)p(y_i)} \right)\]- 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.
- bandwidth
float|int The bandwidth for the kernel.
- kernel
str Type of kernel to use, compatible with the KDE implementation
kde_probability_density_function().- 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
A small
bandwidthcan lead to under-sampling, while a largebandwidthmay over-smooth the data, obscuring details.
- class infomeasure.estimators.mutual_information.MillerMadowCMIEstimator(*data, cond=None, offset: int = 0, base: int | float | str = 'e', **kwargs)[source]#
Bases:
BaseMillerMadowMIEstimator,ConditionalMutualInformationEstimatorEstimator for the discrete Miller-Madow conditional mutual information.
\[\begin{align} \hat{I}_{\tiny{MM}}(X_1; X_2; \ldots; X_n \mid Z)&= \hat{I}_{\tiny{MLE}}(\dots) + \frac{\left(\sum_{i=1}^{n}K_{iZ}-1\right) - \left(K_{1,\dots,i,Z}-1\right) - \left(K_{Z}-1\right)}{2N \cdot \log(\texttt{base})} \end{align}\]\(\hat{I}_{\tiny{MLE}}(X_1; \dots; X_n \mid Z)\) is the initial
DiscreteCMIEstimatorestimate, \(K_{iZ}\) is the number of unique values in the i-th variable joint with Z, \(K_{1,\dots,i,Z}\) is the number of unique joint values, \(K_Z\) is the number of unique values in the Z variable, and \(N\) is the number of samples.- Attributes:
- *dataarray_like,
shape(n_samples,) The data used to estimate the conditional mutual information. You can pass an arbitrary number of data arrays as positional arguments.
- condarray_like
The conditional data used to estimate the conditional mutual information.
- *dataarray_like,
- class infomeasure.estimators.mutual_information.MillerMadowMIEstimator(*data, cond=None, offset: int = 0, base: int | float | str = 'e', **kwargs)[source]#
Bases:
BaseMillerMadowMIEstimator,MutualInformationEstimatorEstimator for the discrete Miller-Madow mutual information.
\[\begin{split}\begin{align}\hat{I}_{\tiny{MM}}(X; Y) &= \hat{H}_{\tiny{MM}}(X) + \hat{H}_{\tiny{MM}}(Y) - \hat{H}_{\tiny{MM}}(X, Y)\\ &= \hat{H}_{\tiny{MLE}}(X) + \hat{H}_{\tiny{MLE}}(Y) - \hat{H}_{\tiny{MLE}}(X, Y) + (K_X + K_Y - K_{XY} - 1)/(2N \cdot \log(\texttt{base}))\\ &= \hat{I}_{\tiny{MLE}}(X; Y) + (K_X + K_Y - K_{XY} - 1)/(2N \cdot \log(\texttt{base}))\\ \end{align}\end{split}\]For an arbitrary number of random variables this is equivalent to:
\[\begin{align}\hat{I}_{\tiny{MM}}(X_1; \dots; X_n) &= \hat{I}_{\tiny{MLE}}(X_1; \dots; X_n) + \frac{\left(\sum_{i=1}^{n}K_i-1\right) - \left(K_{1,\dots,i}-1\right)}{2N \cdot \log(\texttt{base})} \end{align}\]\(\hat{I}_{\tiny{MLE}}(X_1; \dots; X_n)\) is the initial
DiscreteMIEstimatorestimate, \(K_i\) is the number of unique values in the i-th variable, \(K_{1,\dots,i}\) is the number of unique joint values, and \(N\) is the number of samples.- 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.
- 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.
- *dataarray_like,
- class infomeasure.estimators.mutual_information.NsbCMIEstimator(*data, cond=None, K: int = None, offset: int = 0, base: int | float | str = 'e', **kwargs)[source]#
Bases:
BaseNsbMIEstimator,ConditionalMutualInformationEstimatorEstimator for the conditional Nsb mutual information.
Nsb conditional mutual information estimator using the entropy combination formula.
- Attributes:
- *dataarray_like,
shape(n_samples,) The data used to estimate the conditional mutual information. You can pass an arbitrary number of data arrays as positional arguments.
- condarray_like
The conditional data used to estimate the conditional mutual information.
- K
int,optional The support size. If not provided, uses the observed support size.
- 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.
- *dataarray_like,
See also
infomeasure.estimators.entropy.nsb.NsbEntropyEstimatorNsb entropy estimator.
Notes
This estimator uses the Nsb entropy estimator to compute conditional mutual information through the entropy combination formula.
Note that the entropy combination formula is used (_generic_cmi_from_entropy) not a dedicated implementation as other MI might have.
- class infomeasure.estimators.mutual_information.NsbMIEstimator(*data, cond=None, K: int = None, offset: int = 0, base: int | float | str = 'e', **kwargs)[source]#
Bases:
BaseNsbMIEstimator,MutualInformationEstimatorEstimator for the Nsb mutual information.
Nsb mutual information estimator using the entropy combination formula.
- 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,optional The support size. If not provided, uses the observed support size.
- 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.
- *dataarray_like,
See also
infomeasure.estimators.entropy.nsb.NsbEntropyEstimatorNsb entropy estimator.
Notes
This estimator uses the Nsb entropy estimator to compute mutual information through the entropy combination formula.
Note that the entropy combination formula is used (_generic_mi_from_entropy) not a dedicated implementation as other MI might have.
- class infomeasure.estimators.mutual_information.OrdinalCMIEstimator(*data, cond=None, embedding_dim: int = None, step_size: int = 1, stable: bool = False, offset: int = 0, base: int | float | str = 'e', **kwargs)[source]#
Bases:
BaseOrdinalMIEstimator,ConditionalMutualInformationEstimatorEstimator for the Ordinal conditional mutual information.
- Attributes:
- *dataarray_like,
shape(n_samples,) The data used to estimate the conditional mutual information. You can pass an arbitrary number of data arrays as positional arguments.
- condarray_like
The conditional data used to estimate the conditional mutual information.
- embedding_dim
int The size of the permutation patterns.
- *symbolsarray_like,
shape(n_samples,) The symbolized data used to estimate the mutual information.
- symbols_condarray_like,
shape(n_samples,) The symbolized conditional data used to estimate the conditional mutual information.
- *dataarray_like,
- Raises:
ValueErrorIf the
embedding_dimis negative or not an integer.ValueErrorIf
offsetandembedding_dimare such that the data is too small.
Notes
The order will be determined via
numpy.argsort(). There is nonormalizeoption, as this would not influence the order of the data.If
embedding_dimis set to 1, the mutual information is always 0.
- class infomeasure.estimators.mutual_information.OrdinalMIEstimator(*data, cond=None, embedding_dim: int = None, step_size: int = 1, stable: bool = False, offset: int = 0, base: int | float | str = 'e', **kwargs)[source]#
Bases:
BaseOrdinalMIEstimator,MutualInformationEstimatorEstimator for the Ordinal mutual information.
- 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.
- embedding_dim
int The size of the permutation patterns.
- 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.
- *symbolsarray_like,
shape(n_samples,) The symbolized data used to estimate the mutual information.
- *dataarray_like,
- Raises:
-
ValueErrorIf the
embedding_dimis negative or not an integer.ValueErrorIf
offsetandembedding_dimare such that the data is too small.
Notes
The ordinality will be determined via
numpy.argsort(). There is nonormalizeoption, as this would not influence the order of the data.If
embedding_dimis set to 1, the mutual information is always 0.
- class infomeasure.estimators.mutual_information.RenyiCMIEstimator(*data, cond=None, k: int = 4, alpha: float | int = None, noise_level=1e-08, offset: int = 0, normalize: bool = False, base: int | float | str = 'e', **kwargs)[source]#
Bases:
BaseRenyiMIEstimator,ConditionalMutualInformationEstimatorEstimator for the conditional Renyi mutual information.
- Attributes:
- *dataarray_like,
shape(n_samples,) The data used to estimate the conditional mutual information. You can pass an arbitrary number of data arrays as positional arguments.
- condarray_like
The conditional data used to estimate the conditional mutual information.
- k
int The number of nearest neighbors used in the estimation.
- alpha
float|int The Rényi parameter, order or exponent. Sometimes denoted as \(\alpha\) or \(q\).
- noise_level
float The standard deviation of the Gaussian noise to add to the data to avoid issues with zero distances.
- 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 Rényi entropy is a generalization of Shannon entropy, where the small values of probabilities are emphasized for \(\alpha < 1\), and higher probabilities are emphasized for \(\alpha > 1\). For \(\alpha = 1\), it reduces to Shannon entropy. The Rényi-Entropy class can be particularly interesting for systems where additivity (in Shannon sense) is not always preserved, especially in nonlinear complex systems, such as when dealing with long-range forces.
- class infomeasure.estimators.mutual_information.RenyiMIEstimator(*data, cond=None, k: int = 4, alpha: float | int = None, noise_level=1e-08, offset: int = 0, normalize: bool = False, base: int | float | str = 'e', **kwargs)[source]#
Bases:
BaseRenyiMIEstimator,MutualInformationEstimatorEstimator for the Renyi mutual information.
- 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 used in the estimation.
- alpha
float|int The Rényi parameter, order or exponent. Sometimes denoted as \(\alpha\) or \(q\).
- noise_level
float The standard deviation of the Gaussian noise to add to the data to avoid issues with zero distances.
- 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 Rényi entropy is a generalization of Shannon entropy, where the small values of probabilities are emphasized for \(\alpha < 1\), and higher probabilities are emphasized for \(\alpha > 1\). For \(\alpha = 1\), it reduces to Shannon entropy. The Rényi-Entropy class can be particularly interesting for systems where additivity (in Shannon sense) is not always preserved, especially in nonlinear complex systems, such as when dealing with long-range forces.
- class infomeasure.estimators.mutual_information.ShrinkCMIEstimator(*data, cond=None, offset: int = 0, base: int | float | str = 'e', **kwargs)[source]#
Bases:
BaseShrinkMIEstimator,ConditionalMutualInformationEstimatorEstimator for the conditional Shrink mutual information.
Shrink conditional mutual information estimator using the entropy combination formula.
- Attributes:
- *dataarray_like,
shape(n_samples,) The data used to estimate the conditional mutual information. You can pass an arbitrary number of data arrays as positional arguments.
- condarray_like
The conditional data used to estimate the conditional mutual information.
- 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.
- *dataarray_like,
See also
infomeasure.estimators.entropy.shrink.ShrinkEntropyEstimatorShrink entropy estimator.
Notes
This estimator uses the Shrink entropy estimator to compute conditional mutual information through the entropy combination formula.
Note that the entropy combination formula is used (_generic_cmi_from_entropy) not a dedicated implementation as other MI might have.
- class infomeasure.estimators.mutual_information.ShrinkMIEstimator(*data, cond=None, offset: int = 0, base: int | float | str = 'e', **kwargs)[source]#
Bases:
BaseShrinkMIEstimator,MutualInformationEstimatorEstimator for the Shrink mutual information.
Shrink mutual information estimator using the entropy combination formula.
- 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.
- 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.
- *dataarray_like,
See also
infomeasure.estimators.entropy.shrink.ShrinkEntropyEstimatorShrink entropy estimator.
Notes
This estimator uses the Shrink entropy estimator to compute mutual information through the entropy combination formula.
Note that the entropy combination formula is used (_generic_mi_from_entropy) not a dedicated implementation as other MI might have.
- class infomeasure.estimators.mutual_information.TsallisCMIEstimator(*data, cond=None, k: int = 4, q: float | int = None, noise_level: float = 1e-08, offset: int = 0, normalize: bool = False, base: int | float | str = 'e', **kwargs)[source]#
Bases:
BaseTsallisMIEstimator,ConditionalMutualInformationEstimatorEstimator for the conditional Tsallis mutual information.
- Parameters:
- *dataarray_like,
shape(n_samples,) The data used to estimate the conditional mutual information. You can pass an arbitrary number of data arrays as positional arguments.
- condarray_like
The conditional data used to estimate the conditional mutual information.
- k
int The number of nearest neighbors to consider.
- q
float|int The Tsallis parameter, order or exponent. Sometimes denoted as \(q\), analogous to the Rényi parameter \(\alpha\).
- noise_level
float The standard deviation of the Gaussian noise to add to the data to avoid issues with zero distances.
- normalize
If True, normalize the data before analysis.
- *dataarray_like,
Notes
In the \(q \to 1\) limit, the Jackson sum (q-additivity) reduces to ordinary summation, and the Tallis entropy reduces to Shannon Entropy. This class of entropy measure is in particularly useful in the study in connection with long-range correlated systems and with non-equilibrium phenomena.
- class infomeasure.estimators.mutual_information.TsallisMIEstimator(*data, cond=None, k: int = 4, q: float | int = None, noise_level: float = 1e-08, offset: int = 0, normalize: bool = False, base: int | float | str = 'e', **kwargs)[source]#
Bases:
BaseTsallisMIEstimator,MutualInformationEstimatorEstimator for the Tsallis mutual information.
- 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 used in the estimation.
- q
float The Tsallis parameter, order or exponent. Sometimes denoted as \(q\), analogous to the Rényi parameter \(\alpha\).
- noise_level
float The standard deviation of the Gaussian noise to add to the data to avoid issues with zero distances.
- 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
In the \(q \to 1\) limit, the Jackson sum (q-additivity) reduces to ordinary summation, and the Tallis entropy reduces to Shannon Entropy. This class of entropy measure is in particularly useful in the study in connection with long-range correlated systems and with non-equilibrium phenomena.
- class infomeasure.estimators.mutual_information.ZhangCMIEstimator(*data, cond=None, offset: int = 0, base: int | float | str = 'e', **kwargs)[source]#
Bases:
BaseZhangMIEstimator,ConditionalMutualInformationEstimatorEstimator for the conditional Zhang mutual information.
Zhang conditional mutual information estimator using the entropy combination formula.
- Attributes:
- *dataarray_like,
shape(n_samples,) The data used to estimate the conditional mutual information. You can pass an arbitrary number of data arrays as positional arguments.
- condarray_like
The conditional data used to estimate the conditional mutual information.
- 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.
- *dataarray_like,
See also
infomeasure.estimators.entropy.zhang.ZhangEntropyEstimatorZhang entropy estimator.
Notes
This estimator uses the Zhang entropy estimator to compute conditional mutual information through the entropy combination formula.
Note that the entropy combination formula is used (_generic_cmi_from_entropy) not a dedicated implementation as other MI might have.
- class infomeasure.estimators.mutual_information.ZhangMIEstimator(*data, cond=None, offset: int = 0, base: int | float | str = 'e', **kwargs)[source]#
Bases:
BaseZhangMIEstimator,MutualInformationEstimatorEstimator for the Zhang mutual information.
Zhang mutual information estimator using the entropy combination formula.
- 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.
- 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.
- *dataarray_like,
See also
infomeasure.estimators.entropy.zhang.ZhangEntropyEstimatorZhang entropy estimator.
Notes
This estimator uses the Zhang entropy estimator to compute mutual information through the entropy combination formula.
Note that the entropy combination formula is used (_generic_mi_from_entropy) not a dedicated implementation as other MI might have.