infomeasure.estimators.transfer_entropy package#

Submodules#

infomeasure.estimators.transfer_entropy.discrete module#

Module for the discrete transfer entropy estimator.

class infomeasure.estimators.transfer_entropy.discrete.BaseDiscreteTEEstimator(source, dest, *, cond=None, prop_time: int = 0, step_size: int = 1, src_hist_len: int = 1, dest_hist_len: int = 1, cond_hist_len: int = 1, offset: int = None, base: int | float | str = 'e')[source]#

Bases: ABC

Base class for discrete transfer entropy estimators.

Attributes:
source, destarray_like

The source (X) and destination (Y) data used to estimate the transfer entropy.

condarray_like, optional

The conditional data used to estimate the conditional transfer entropy.

prop_timeint, optional

Number of positions to shift the data arrays relative to each other (multiple of step_size). Delay/lag/shift between the variables, representing propagation time. Assumed time taken by info to transfer from source to destination. Not compatible with the cond parameter / conditional TE. Alternatively called offset.

step_sizeint, optional

Step size between elements for the state space reconstruction.

src_hist_len, dest_hist_lenint, optional

Number of past observations to consider for the source and destination data.

cond_hist_lenint, optional

Number of past observations to consider for the conditional data. Only used for conditional transfer entropy.

class infomeasure.estimators.transfer_entropy.discrete.DiscreteCTEEstimator(source, dest, *, cond=None, prop_time: int = 0, step_size: int = 1, src_hist_len: int = 1, dest_hist_len: int = 1, cond_hist_len: int = 1, offset: int = None, base: int | float | str = 'e')[source]#

Bases: BaseDiscreteTEEstimator, ConditionalTransferEntropyEstimator

Estimator for discrete conditional transfer entropy.

Attributes:
source, dest, condarray_like

The source (X), destination (Y), and conditional (Z) data used to estimate the conditional transfer entropy.

step_sizeint

Step size between elements for the state space reconstruction.

src_hist_len, dest_hist_len, cond_hist_lenint, optional

Number of past observations to consider for the source, destination, and conditional data.

prop_timeint, optional

Not compatible with the cond parameter / conditional TE.

class infomeasure.estimators.transfer_entropy.discrete.DiscreteTEEstimator(source, dest, *, cond=None, prop_time: int = 0, step_size: int = 1, src_hist_len: int = 1, dest_hist_len: int = 1, cond_hist_len: int = 1, offset: int = None, base: int | float | str = 'e')[source]#

Bases: BaseDiscreteTEEstimator, PValueMixin, EffectiveValueMixin, TransferEntropyEstimator

Estimator for discrete transfer entropy.

Attributes:
source, destarray_like

The source (X) and destination (Y) data used to estimate the transfer entropy.

prop_timeint, optional

Number of positions to shift the data arrays relative to each other (multiple of step_size). Delay/lag/shift between the variables, representing propagation time. Assumed time taken by info to transfer from source to destination. Alternatively called offset.

step_sizeint

Step size between elements for the state space reconstruction.

src_hist_len, dest_hist_lenint

Number of past observations to consider for the source and destination data.

infomeasure.estimators.transfer_entropy.kernel module#

Module for the kernel-based transfer entropy estimator.

class infomeasure.estimators.transfer_entropy.kernel.BaseKernelTEEstimator(source, dest, *, cond=None, bandwidth: float | int = None, kernel: str = None, prop_time: int = 0, step_size: int = 1, src_hist_len: int = 1, dest_hist_len: int = 1, cond_hist_len: int = 1, workers: int = 1, offset: int = None, base: int | float | str = 'e')[source]#

Bases: WorkersMixin, ABC

Base class for transfer entropy using Kernel Density Estimation (KDE).

Attributes:
source, destarray_like

The source (X) and destination (Y) data used to estimate the transfer entropy.

condarray_like, optional

The conditional data used to estimate the conditional transfer entropy.

bandwidthfloat | int

The bandwidth for the kernel.

kernelstr

Type of kernel to use, compatible with the KDE implementation kde_probability_density_function().

prop_timeint, optional

Number of positions to shift the data arrays relative to each other (multiple of step_size). Delay/lag/shift between the variables, representing propagation time. Assumed time taken by info to transfer from source to destination. Not compatible with the cond parameter / conditional TE. Alternatively called offset.

step_sizeint, optional

Step size between elements for the state space reconstruction.

src_hist_len, dest_hist_lenint, optional

Number of past observations to consider for the source and destination data.

cond_hist_lenint, optional

Number of past observations to consider for the conditional data. Only used for conditional transfer entropy.

workersint, 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.

class infomeasure.estimators.transfer_entropy.kernel.KernelCTEEstimator(source, dest, *, cond=None, bandwidth: float | int = None, kernel: str = None, prop_time: int = 0, step_size: int = 1, src_hist_len: int = 1, dest_hist_len: int = 1, cond_hist_len: int = 1, workers: int = 1, offset: int = None, base: int | float | str = 'e')[source]#

Bases: BaseKernelTEEstimator, ConditionalTransferEntropyEstimator

Estimator for conditional transfer entropy using Kernel Density Estimation (KDE).

Attributes:
source, dest, condarray_like

The source (X), destination (Y), and conditional (Z) data used to estimate the conditional transfer entropy.

bandwidthfloat | int

The bandwidth for the kernel.

kernelstr

Type of kernel to use, compatible with the KDE implementation kde_probability_density_function().

step_sizeint

Step size between elements for the state space reconstruction.

src_hist_len, dest_hist_len, cond_hist_lenint, optional

Number of past observations to consider for the source, destination, and conditional data.

prop_timeint, optional

Not compatible with the cond parameter / conditional TE.

Notes

A small bandwidth can lead to under-sampling, while a large bandwidth may over-smooth the data, obscuring details.

class infomeasure.estimators.transfer_entropy.kernel.KernelTEEstimator(source, dest, *, cond=None, bandwidth: float | int = None, kernel: str = None, prop_time: int = 0, step_size: int = 1, src_hist_len: int = 1, dest_hist_len: int = 1, cond_hist_len: int = 1, workers: int = 1, offset: int = None, base: int | float | str = 'e')[source]#

Bases: BaseKernelTEEstimator, PValueMixin, EffectiveValueMixin, TransferEntropyEstimator

Estimator for transfer entropy using Kernel Density Estimation (KDE).

Attributes:
source, destarray_like

The source (X) and destination (Y) data used to estimate the transfer entropy.

bandwidthfloat | int

The bandwidth for the kernel.

kernelstr

Type of kernel to use, compatible with the KDE implementation kde_probability_density_function().

prop_timeint, optional

Number of positions to shift the data arrays relative to each other (multiple of step_size). Delay/lag/shift between the variables, representing propagation time. Assumed time taken by info to transfer from source to destination. Alternatively called offset.

step_sizeint

Step size between elements for the state space reconstruction.

src_hist_len, dest_hist_lenint

Number of past observations to consider for the source and destination data.

Notes

A small bandwidth can lead to under-sampling, while a large bandwidth may over-smooth the data, obscuring details.

infomeasure.estimators.transfer_entropy.kraskov_stoegbauer_grassberger module#

Module for the Kraskov-Stoegbauer-Grassberger (KSG) transfer entropy estimator.

class infomeasure.estimators.transfer_entropy.kraskov_stoegbauer_grassberger.BaseKSGTEEstimator(source, dest, *, cond=None, k: int = 4, noise_level=1e-08, minkowski_p=inf, prop_time: int = 0, step_size: int = 1, src_hist_len: int = 1, dest_hist_len: int = 1, cond_hist_len: int = 1, offset: int = None, base: int | float | str = 'e')[source]#

Bases: ABC

Base class for transfer entropy using the Kraskov-Stoegbauer-Grassberger (KSG) method.

Attributes:
source, destarray_like

The source (X) and destination (Y) data used to estimate the transfer entropy.

cond

The conditional data used to estimate the conditional transfer entropy.

kint

Number of nearest neighbors to consider.

noise_levelfloat, None or False

Standard deviation of Gaussian noise to add to the data. Adds \(\mathcal{N}(0, \text{noise}^2)\) to each data point.

minkowski_pfloat, \(1 \leq p \leq \infty\)

The power parameter for the Minkowski metric. Default is np.inf for maximum norm. Use 2 for Euclidean distance.

prop_timeint, optional

Number of positions to shift the data arrays relative to each other (multiple of step_size). Delay/lag/shift between the variables, representing propagation time. Assumed time taken by info to transfer from source to destination. Not compatible with the cond parameter / conditional TE. Alternatively called offset.

step_sizeint, optional

Step size between elements for the state space reconstruction.

src_hist_len, dest_hist_lenint, optional

Number of past observations to consider for the source and destination data.

cond_hist_lenint, optional

Number of past observations to consider for the conditional data. Only used for conditional transfer entropy.

class infomeasure.estimators.transfer_entropy.kraskov_stoegbauer_grassberger.KSGCTEEstimator(source, dest, *, cond=None, k: int = 4, noise_level=1e-08, minkowski_p=inf, prop_time: int = 0, step_size: int = 1, src_hist_len: int = 1, dest_hist_len: int = 1, cond_hist_len: int = 1, offset: int = None, base: int | float | str = 'e')[source]#

Bases: BaseKSGTEEstimator, ConditionalTransferEntropyEstimator

Estimator for conditional transfer entropy using the Kraskov-Stoegbauer-Grassberger (KSG) method.

Attributes:
source, dest, condarray_like

The source (X), destination (Y), and conditional (Z) data used to estimate the conditional transfer entropy.

kint

Number of nearest neighbors to consider.

noise_levelfloat, None or False

Standard deviation of Gaussian noise to add to the data. Adds \(\mathcal{N}(0, ext{noise}^2)\) to each data point.

minkowski_pfloat, \(1 \leq p \leq \infty\)

The power parameter for the Minkowski metric. Default is np.inf for maximum norm. Use 2 for Euclidean distance.

step_sizeint

Step size between elements for the state space reconstruction.

src_hist_len, dest_hist_len, cond_hist_lenint, optional

Number of past observations to consider for the source, destination, and conditional data.

prop_timeint, optional

Not compatible with the cond parameter / conditional TE.

Notes

Changing the number of nearest neighbors k can change the outcome, but the default value of \(k=4\) is recommended by [KStogbauerG11].

class infomeasure.estimators.transfer_entropy.kraskov_stoegbauer_grassberger.KSGTEEstimator(source, dest, *, cond=None, k: int = 4, noise_level=1e-08, minkowski_p=inf, prop_time: int = 0, step_size: int = 1, src_hist_len: int = 1, dest_hist_len: int = 1, cond_hist_len: int = 1, offset: int = None, base: int | float | str = 'e')[source]#

Bases: BaseKSGTEEstimator, PValueMixin, EffectiveValueMixin, TransferEntropyEstimator

Estimator for transfer entropy using the Kraskov-Stoegbauer-Grassberger (KSG) method.

Attributes:
source, destarray_like

The source (X) and destination (Y) data used to estimate the transfer entropy.

kint

Number of nearest neighbors to consider.

noise_levelfloat, None or False

Standard deviation of Gaussian noise to add to the data. Adds \(\mathcal{N}(0, \text{noise}^2)\) to each data point.

minkowski_pfloat, \(1 \leq p \leq \infty\)

The power parameter for the Minkowski metric. Default is np.inf for maximum norm. Use 2 for Euclidean distance.

prop_timeint, optional

Number of positions to shift the data arrays relative to each other (multiple of step_size). Delay/lag/shift between the variables, representing propagation time. Assumed time taken by info to transfer from source to destination. Alternatively called offset.

step_sizeint, optional

Step size between elements for the state space reconstruction.

src_hist_len, dest_hist_lenint

Number of past observations to consider for the source and destination data.

Notes

Changing the number of nearest neighbors k can change the outcome, but the default value of \(k=4\) is recommended by [KStogbauerG11].

infomeasure.estimators.transfer_entropy.ordinal module#

Module for the Ordinal / Permutation transfer entropy estimator.

class infomeasure.estimators.transfer_entropy.ordinal.BaseOrdinalTEEstimator(source, dest, *, cond=None, embedding_dim: int, stable: bool = False, prop_time: int = 0, step_size: int = 1, src_hist_len: int = 1, dest_hist_len: int = 1, cond_hist_len: int = 1, offset: int = None, base: int | float | str = 'e')[source]#

Bases: ABC

Base class for the Ordinal / Permutation transfer entropy.

Attributes:
source, destarray_like

The source (X) and dest (Y) data used to estimate the transfer entropy.

condarray_like, optional

The conditional data used to estimate the conditional transfer entropy.

embedding_dimint

The size of the permutation patterns.

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.

prop_timeint, optional

Number of positions to shift the data arrays relative to each other (multiple of step_size). Delay/lag/shift between the variables, representing propagation time. Not compatible with the cond parameter / conditional TE. Alternatively called offset.

step_sizeint, optional

Step size between elements for the state space reconstruction.

src_hist_len, dest_hist_lenint, optional

Number of past observations to consider for the source and destination data.

cond_hist_lenint, optional

Number of past observations to consider for the conditional data. Only used for conditional transfer entropy.

Raises:
ValueError

If the embedding_dim is negative or not an integer.

ValueError

If the embedding_dim is too large for the given data.

ValueError

If step_size, prop_time, and embedding_dim are such that the data is too small.

TypeError

If the data are not 1d array-like(s).

Notes

If embedding_dim is set to 1, the transfer entropy is always 0.

class infomeasure.estimators.transfer_entropy.ordinal.OrdinalCTEEstimator(source, dest, *, cond=None, embedding_dim: int, stable: bool = False, prop_time: int = 0, step_size: int = 1, src_hist_len: int = 1, dest_hist_len: int = 1, cond_hist_len: int = 1, offset: int = None, base: int | float | str = 'e')[source]#

Bases: BaseOrdinalTEEstimator, ConditionalTransferEntropyEstimator

Estimator for the Ordinal / Permutation conditional transfer entropy.

Attributes:
source, dest, condarray_like

The source (X), destination (Y), and conditional (Z) data used to estimate the conditional transfer entropy.

embedding_dimint

The size of the permutation patterns.

prop_timeint, optional

Number of positions to shift the data arrays relative to each other (multiple of step_size). Delay/lag/shift between the variables, representing propagation time. Assumed time taken by info to transfer from source to destination.

step_sizeint

Step size between elements for the state space reconstruction.

src_hist_len, dest_hist_len, cond_hist_lenint

Number of past observations to consider for the source, destination, and conditional data.

Raises:
ValueError

If the embedding_dim is negative or not an integer.

ValueError

If the embedding_dim is too large for the given data.

ValueError

If step_size, prop_time, and embedding_dim are such that the data is too small.

Notes

If embedding_dim is set to 1, the transfer entropy is always 0.

class infomeasure.estimators.transfer_entropy.ordinal.OrdinalTEEstimator(source, dest, *, cond=None, embedding_dim: int, stable: bool = False, prop_time: int = 0, step_size: int = 1, src_hist_len: int = 1, dest_hist_len: int = 1, cond_hist_len: int = 1, offset: int = None, base: int | float | str = 'e')[source]#

Bases: BaseOrdinalTEEstimator, PValueMixin, EffectiveValueMixin, TransferEntropyEstimator

Estimator for the Ordinal / Permutation transfer entropy.

Attributes:
source, destarray_like

The source (X) and dest (Y) data used to estimate the transfer entropy.

embedding_dimint

The size of the permutation patterns.

prop_timeint, optional

Number of positions to shift the data arrays relative to each other (multiple of step_size). Delay/lag/shift between the variables, representing propagation time. Assumed time taken by info to transfer from source to destination. Alternatively called offset.

step_sizeint

Step size between elements for the state space reconstruction.

src_hist_len, dest_hist_lenint

Number of past observations to consider for the source and destination data.

Raises:
ValueError

If the embedding_dim is negative or not an integer.

ValueError

If the embedding_dim is too large for the given data.

ValueError

If step_size, prop_time, and embedding_dim are such that the data is too small.

Notes

If embedding_dim is set to 1, the transfer entropy is always 0.

infomeasure.estimators.transfer_entropy.renyi module#

Module for the Renyi transfer entropy estimator.

class infomeasure.estimators.transfer_entropy.renyi.BaseRenyiTEEstimator(source, dest, *, cond=None, k: int = 4, alpha: float | int = None, noise_level=1e-08, prop_time: int = 0, step_size: int = 1, src_hist_len: int = 1, dest_hist_len: int = 1, cond_hist_len: int = 1, offset: int = None, base: int | float | str = 'e')[source]#

Bases: ABC

Base class for the Renyi transfer entropy.

Attributes:
source, destarray_like

The source (X) and dest (Y) data used to estimate the transfer entropy.

condarray_like, optional

The conditional data used to estimate the conditional transfer entropy.

kint

The number of nearest neighbors used in the estimation.

alphafloat | int

The Rényi parameter, order or exponent. Sometimes denoted as \(\alpha\) or \(q\).

noise_levelfloat

The standard deviation of the Gaussian noise to add to the data to avoid issues with zero distances.

prop_timeint, optional

Number of positions to shift the data arrays relative to each other (multiple of step_size). Delay/lag/shift between the variables, representing propagation time. Assumed time taken by info to transfer from source to destination. Not compatible with the cond parameter / conditional TE. Alternatively called offset.

step_sizeint, optional

Step size between elements for the state space reconstruction.

src_hist_len, dest_hist_lenint, optional

Number of past observations to consider for the source and destination data.

cond_hist_lenint, optional

Number of past observations to consider for the conditional data. Only used for conditional transfer entropy.

Raises:
ValueError

If the Renyi parameter is not a positive number.

ValueError

If the number of nearest neighbors is not a positive integer.

ValueError

If the step_size is not a non-negative integer.

class infomeasure.estimators.transfer_entropy.renyi.RenyiCTEEstimator(source, dest, *, cond=None, k: int = 4, alpha: float | int = None, noise_level=1e-08, prop_time: int = 0, step_size: int = 1, src_hist_len: int = 1, dest_hist_len: int = 1, cond_hist_len: int = 1, offset: int = None, base: int | float | str = 'e')[source]#

Bases: BaseRenyiTEEstimator, ConditionalTransferEntropyEstimator

Estimator for the Renyi conditional transfer entropy.

Attributes:
source, dest, condarray_like

The source (X), destination (Y), and conditional (Z) data used to estimate the conditional transfer entropy.

kint

The number of nearest neighbors used in the estimation.

alphafloat | int

The Rényi parameter, order or exponent. Sometimes denoted as \(\alpha\) or \(q\).

noise_levelfloat

The standard deviation of the Gaussian noise to add to the data to avoid issues with zero distances.

step_sizeint

Step size between elements for the state space reconstruction.

src_hist_len, dest_hist_len, cond_hist_lenint

Number of past observations to consider for the source, destination, and conditional data.

Raises:
ValueError

If the Renyi parameter is not a positive number.

ValueError

If the number of nearest neighbors is not a positive integer.

ValueError

If the step_size is not a non-negative integer.

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.transfer_entropy.renyi.RenyiTEEstimator(source, dest, *, cond=None, k: int = 4, alpha: float | int = None, noise_level=1e-08, prop_time: int = 0, step_size: int = 1, src_hist_len: int = 1, dest_hist_len: int = 1, cond_hist_len: int = 1, offset: int = None, base: int | float | str = 'e')[source]#

Bases: BaseRenyiTEEstimator, PValueMixin, EffectiveValueMixin, TransferEntropyEstimator

Estimator for the Renyi transfer entropy.

Attributes:
source, destarray_like

The source (X) and dest (Y) data used to estimate the transfer entropy.

kint

The number of nearest neighbors used in the estimation.

alphafloat | int

The Rényi parameter, order or exponent. Sometimes denoted as \(\alpha\) or \(q\).

noise_levelfloat

The standard deviation of the Gaussian noise to add to the data to avoid issues with zero distances.

prop_timeint, optional

Number of positions to shift the data arrays relative to each other (multiple of step_size). Delay/lag/shift between the variables, representing propagation time. Assumed time taken by info to transfer from source to destination. Alternatively called offset.

step_sizeint, optional

Step size between elements for the state space reconstruction.

src_hist_len, dest_hist_lenint, optional

Number of past observations to consider for the source and destination data.

Raises:
ValueError

If the Renyi parameter is not a positive number.

ValueError

If the number of nearest neighbors is not a positive integer.

ValueError

If the step_size is not a non-negative integer.

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.transfer_entropy.tsallis module#

Module for the Tsallis transfer entropy estimator.

class infomeasure.estimators.transfer_entropy.tsallis.BaseTsallisTEEstimator(source, dest, *, cond=None, k: int = 4, q: float | int = None, noise_level=1e-08, prop_time: int = 0, step_size: int = 1, src_hist_len: int = 1, dest_hist_len: int = 1, cond_hist_len: int = 1, offset: int = None, base: int | float | str = 'e')[source]#

Bases: ABC

Base class for the Tsallis transfer entropy.

Attributes:
source, destarray_like

The source (X) and dest (Y) data used to estimate the transfer entropy.

condarray_like, optional

The conditional data used to estimate the conditional transfer entropy.

kint

The number of nearest neighbors used in the estimation.

qfloat | int

The Tsallis parameter, order or exponent. Sometimes denoted as \(q\), analogous to the Rényi parameter \(\alpha\).

noise_levelfloat

The standard deviation of the Gaussian noise to add to the data to avoid issues with zero distances.

prop_timeint, optional

Number of positions to shift the data arrays relative to each other (multiple of step_size). Delay/lag/shift between the variables, representing propagation time. Assumed time taken by info to transfer from source to destination. Not compatible with the cond parameter / conditional TE. Alternatively called offset.

step_sizeint, optional

Step size between elements for the state space reconstruction.

src_hist_len, dest_hist_lenint, optional

Number of past observations to consider for the source and destination data.

cond_hist_lenint, optional

Number of past observations to consider for the conditional data. Only used for conditional transfer entropy.

Raises:
ValueError

If the Tsallis parameter is not a positive number.

ValueError

If the number of nearest neighbors is not a positive integer.

ValueError

If the step_size is not a non-negative integer.

class infomeasure.estimators.transfer_entropy.tsallis.TsallisCTEEstimator(source, dest, *, cond=None, k: int = 4, q: float | int = None, noise_level=1e-08, prop_time: int = 0, step_size: int = 1, src_hist_len: int = 1, dest_hist_len: int = 1, cond_hist_len: int = 1, offset: int = None, base: int | float | str = 'e')[source]#

Bases: BaseTsallisTEEstimator, ConditionalTransferEntropyEstimator

Estimator for the Tsallis conditional transfer entropy.

Attributes:
source, dest, condarray_like

The source (X), destination (Y) and conditional (Z) data used to estimate the conditional transfer entropy.

kint

The number of nearest neighbors used in the estimation.

qfloat | int

The Tsallis parameter, order or exponent. Sometimes denoted as \(q\), analogous to the Rényi parameter \(\alpha\).

noise_levelfloat

The standard deviation of the Gaussian noise to add to the data to avoid issues with zero distances.

step_sizeint, optional

Step size between elements for the state space reconstruction.

src_hist_len, dest_hist_len, cond_hist_lenint, optional

Number of past observations to consider for the source, destination and conditional data.

Raises:
ValueError

If the Tsallis parameter is not a positive number.

ValueError

If the number of nearest neighbors is not a positive integer.

ValueError

If the step_size is not a non-negative integer.

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.transfer_entropy.tsallis.TsallisTEEstimator(source, dest, *, cond=None, k: int = 4, q: float | int = None, noise_level=1e-08, prop_time: int = 0, step_size: int = 1, src_hist_len: int = 1, dest_hist_len: int = 1, cond_hist_len: int = 1, offset: int = None, base: int | float | str = 'e')[source]#

Bases: BaseTsallisTEEstimator, PValueMixin, EffectiveValueMixin, TransferEntropyEstimator

Estimator for the Tsallis transfer entropy.

Attributes:
source, destarray_like

The source (X) and dest (Y) data used to estimate the transfer entropy.

kint

The number of nearest neighbors used in the estimation.

qfloat | int

The Tsallis parameter, order or exponent. Sometimes denoted as \(q\), analogous to the Rényi parameter \(\alpha\).

noise_levelfloat

The standard deviation of the Gaussian noise to add to the data to avoid issues with zero distances.

prop_timeint, optional

Number of positions to shift the data arrays relative to each other (multiple of step_size). Delay/lag/shift between the variables, representing propagation time. Assumed time taken by info to transfer from source to destination. Alternatively called offset.

step_sizeint, optional

Step size between elements for the state space reconstruction.

src_hist_len, dest_hist_lenint, optional

Number of past observations to consider for the source and destination data.

Raises:
ValueError

If the Tsallis parameter is not a positive number.

ValueError

If the number of nearest neighbors is not a positive integer.

ValueError

If the step_size is not a non-negative integer.

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.

Module contents#

Transfer entropy estimators.

class infomeasure.estimators.transfer_entropy.DiscreteCTEEstimator(source, dest, *, cond=None, prop_time: int = 0, step_size: int = 1, src_hist_len: int = 1, dest_hist_len: int = 1, cond_hist_len: int = 1, offset: int = None, base: int | float | str = 'e')[source]#

Bases: BaseDiscreteTEEstimator, ConditionalTransferEntropyEstimator

Estimator for discrete conditional transfer entropy.

Attributes:
source, dest, condarray_like

The source (X), destination (Y), and conditional (Z) data used to estimate the conditional transfer entropy.

step_sizeint

Step size between elements for the state space reconstruction.

src_hist_len, dest_hist_len, cond_hist_lenint, optional

Number of past observations to consider for the source, destination, and conditional data.

prop_timeint, optional

Not compatible with the cond parameter / conditional TE.

class infomeasure.estimators.transfer_entropy.DiscreteTEEstimator(source, dest, *, cond=None, prop_time: int = 0, step_size: int = 1, src_hist_len: int = 1, dest_hist_len: int = 1, cond_hist_len: int = 1, offset: int = None, base: int | float | str = 'e')[source]#

Bases: BaseDiscreteTEEstimator, PValueMixin, EffectiveValueMixin, TransferEntropyEstimator

Estimator for discrete transfer entropy.

Attributes:
source, destarray_like

The source (X) and destination (Y) data used to estimate the transfer entropy.

prop_timeint, optional

Number of positions to shift the data arrays relative to each other (multiple of step_size). Delay/lag/shift between the variables, representing propagation time. Assumed time taken by info to transfer from source to destination. Alternatively called offset.

step_sizeint

Step size between elements for the state space reconstruction.

src_hist_len, dest_hist_lenint

Number of past observations to consider for the source and destination data.

class infomeasure.estimators.transfer_entropy.KSGCTEEstimator(source, dest, *, cond=None, k: int = 4, noise_level=1e-08, minkowski_p=inf, prop_time: int = 0, step_size: int = 1, src_hist_len: int = 1, dest_hist_len: int = 1, cond_hist_len: int = 1, offset: int = None, base: int | float | str = 'e')[source]#

Bases: BaseKSGTEEstimator, ConditionalTransferEntropyEstimator

Estimator for conditional transfer entropy using the Kraskov-Stoegbauer-Grassberger (KSG) method.

Attributes:
source, dest, condarray_like

The source (X), destination (Y), and conditional (Z) data used to estimate the conditional transfer entropy.

kint

Number of nearest neighbors to consider.

noise_levelfloat, None or False

Standard deviation of Gaussian noise to add to the data. Adds \(\mathcal{N}(0, ext{noise}^2)\) to each data point.

minkowski_pfloat, \(1 \leq p \leq \infty\)

The power parameter for the Minkowski metric. Default is np.inf for maximum norm. Use 2 for Euclidean distance.

step_sizeint

Step size between elements for the state space reconstruction.

src_hist_len, dest_hist_len, cond_hist_lenint, optional

Number of past observations to consider for the source, destination, and conditional data.

prop_timeint, optional

Not compatible with the cond parameter / conditional TE.

Notes

Changing the number of nearest neighbors k can change the outcome, but the default value of \(k=4\) is recommended by [KStogbauerG11].

class infomeasure.estimators.transfer_entropy.KSGTEEstimator(source, dest, *, cond=None, k: int = 4, noise_level=1e-08, minkowski_p=inf, prop_time: int = 0, step_size: int = 1, src_hist_len: int = 1, dest_hist_len: int = 1, cond_hist_len: int = 1, offset: int = None, base: int | float | str = 'e')[source]#

Bases: BaseKSGTEEstimator, PValueMixin, EffectiveValueMixin, TransferEntropyEstimator

Estimator for transfer entropy using the Kraskov-Stoegbauer-Grassberger (KSG) method.

Attributes:
source, destarray_like

The source (X) and destination (Y) data used to estimate the transfer entropy.

kint

Number of nearest neighbors to consider.

noise_levelfloat, None or False

Standard deviation of Gaussian noise to add to the data. Adds \(\mathcal{N}(0, \text{noise}^2)\) to each data point.

minkowski_pfloat, \(1 \leq p \leq \infty\)

The power parameter for the Minkowski metric. Default is np.inf for maximum norm. Use 2 for Euclidean distance.

prop_timeint, optional

Number of positions to shift the data arrays relative to each other (multiple of step_size). Delay/lag/shift between the variables, representing propagation time. Assumed time taken by info to transfer from source to destination. Alternatively called offset.

step_sizeint, optional

Step size between elements for the state space reconstruction.

src_hist_len, dest_hist_lenint

Number of past observations to consider for the source and destination data.

Notes

Changing the number of nearest neighbors k can change the outcome, but the default value of \(k=4\) is recommended by [KStogbauerG11].

class infomeasure.estimators.transfer_entropy.KernelCTEEstimator(source, dest, *, cond=None, bandwidth: float | int = None, kernel: str = None, prop_time: int = 0, step_size: int = 1, src_hist_len: int = 1, dest_hist_len: int = 1, cond_hist_len: int = 1, workers: int = 1, offset: int = None, base: int | float | str = 'e')[source]#

Bases: BaseKernelTEEstimator, ConditionalTransferEntropyEstimator

Estimator for conditional transfer entropy using Kernel Density Estimation (KDE).

Attributes:
source, dest, condarray_like

The source (X), destination (Y), and conditional (Z) data used to estimate the conditional transfer entropy.

bandwidthfloat | int

The bandwidth for the kernel.

kernelstr

Type of kernel to use, compatible with the KDE implementation kde_probability_density_function().

step_sizeint

Step size between elements for the state space reconstruction.

src_hist_len, dest_hist_len, cond_hist_lenint, optional

Number of past observations to consider for the source, destination, and conditional data.

prop_timeint, optional

Not compatible with the cond parameter / conditional TE.

Notes

A small bandwidth can lead to under-sampling, while a large bandwidth may over-smooth the data, obscuring details.

class infomeasure.estimators.transfer_entropy.KernelTEEstimator(source, dest, *, cond=None, bandwidth: float | int = None, kernel: str = None, prop_time: int = 0, step_size: int = 1, src_hist_len: int = 1, dest_hist_len: int = 1, cond_hist_len: int = 1, workers: int = 1, offset: int = None, base: int | float | str = 'e')[source]#

Bases: BaseKernelTEEstimator, PValueMixin, EffectiveValueMixin, TransferEntropyEstimator

Estimator for transfer entropy using Kernel Density Estimation (KDE).

Attributes:
source, destarray_like

The source (X) and destination (Y) data used to estimate the transfer entropy.

bandwidthfloat | int

The bandwidth for the kernel.

kernelstr

Type of kernel to use, compatible with the KDE implementation kde_probability_density_function().

prop_timeint, optional

Number of positions to shift the data arrays relative to each other (multiple of step_size). Delay/lag/shift between the variables, representing propagation time. Assumed time taken by info to transfer from source to destination. Alternatively called offset.

step_sizeint

Step size between elements for the state space reconstruction.

src_hist_len, dest_hist_lenint

Number of past observations to consider for the source and destination data.

Notes

A small bandwidth can lead to under-sampling, while a large bandwidth may over-smooth the data, obscuring details.

class infomeasure.estimators.transfer_entropy.OrdinalCTEEstimator(source, dest, *, cond=None, embedding_dim: int, stable: bool = False, prop_time: int = 0, step_size: int = 1, src_hist_len: int = 1, dest_hist_len: int = 1, cond_hist_len: int = 1, offset: int = None, base: int | float | str = 'e')[source]#

Bases: BaseOrdinalTEEstimator, ConditionalTransferEntropyEstimator

Estimator for the Ordinal / Permutation conditional transfer entropy.

Attributes:
source, dest, condarray_like

The source (X), destination (Y), and conditional (Z) data used to estimate the conditional transfer entropy.

embedding_dimint

The size of the permutation patterns.

prop_timeint, optional

Number of positions to shift the data arrays relative to each other (multiple of step_size). Delay/lag/shift between the variables, representing propagation time. Assumed time taken by info to transfer from source to destination.

step_sizeint

Step size between elements for the state space reconstruction.

src_hist_len, dest_hist_len, cond_hist_lenint

Number of past observations to consider for the source, destination, and conditional data.

Raises:
ValueError

If the embedding_dim is negative or not an integer.

ValueError

If the embedding_dim is too large for the given data.

ValueError

If step_size, prop_time, and embedding_dim are such that the data is too small.

Notes

If embedding_dim is set to 1, the transfer entropy is always 0.

class infomeasure.estimators.transfer_entropy.OrdinalTEEstimator(source, dest, *, cond=None, embedding_dim: int, stable: bool = False, prop_time: int = 0, step_size: int = 1, src_hist_len: int = 1, dest_hist_len: int = 1, cond_hist_len: int = 1, offset: int = None, base: int | float | str = 'e')[source]#

Bases: BaseOrdinalTEEstimator, PValueMixin, EffectiveValueMixin, TransferEntropyEstimator

Estimator for the Ordinal / Permutation transfer entropy.

Attributes:
source, destarray_like

The source (X) and dest (Y) data used to estimate the transfer entropy.

embedding_dimint

The size of the permutation patterns.

prop_timeint, optional

Number of positions to shift the data arrays relative to each other (multiple of step_size). Delay/lag/shift between the variables, representing propagation time. Assumed time taken by info to transfer from source to destination. Alternatively called offset.

step_sizeint

Step size between elements for the state space reconstruction.

src_hist_len, dest_hist_lenint

Number of past observations to consider for the source and destination data.

Raises:
ValueError

If the embedding_dim is negative or not an integer.

ValueError

If the embedding_dim is too large for the given data.

ValueError

If step_size, prop_time, and embedding_dim are such that the data is too small.

Notes

If embedding_dim is set to 1, the transfer entropy is always 0.

class infomeasure.estimators.transfer_entropy.RenyiCTEEstimator(source, dest, *, cond=None, k: int = 4, alpha: float | int = None, noise_level=1e-08, prop_time: int = 0, step_size: int = 1, src_hist_len: int = 1, dest_hist_len: int = 1, cond_hist_len: int = 1, offset: int = None, base: int | float | str = 'e')[source]#

Bases: BaseRenyiTEEstimator, ConditionalTransferEntropyEstimator

Estimator for the Renyi conditional transfer entropy.

Attributes:
source, dest, condarray_like

The source (X), destination (Y), and conditional (Z) data used to estimate the conditional transfer entropy.

kint

The number of nearest neighbors used in the estimation.

alphafloat | int

The Rényi parameter, order or exponent. Sometimes denoted as \(\alpha\) or \(q\).

noise_levelfloat

The standard deviation of the Gaussian noise to add to the data to avoid issues with zero distances.

step_sizeint

Step size between elements for the state space reconstruction.

src_hist_len, dest_hist_len, cond_hist_lenint

Number of past observations to consider for the source, destination, and conditional data.

Raises:
ValueError

If the Renyi parameter is not a positive number.

ValueError

If the number of nearest neighbors is not a positive integer.

ValueError

If the step_size is not a non-negative integer.

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.transfer_entropy.RenyiTEEstimator(source, dest, *, cond=None, k: int = 4, alpha: float | int = None, noise_level=1e-08, prop_time: int = 0, step_size: int = 1, src_hist_len: int = 1, dest_hist_len: int = 1, cond_hist_len: int = 1, offset: int = None, base: int | float | str = 'e')[source]#

Bases: BaseRenyiTEEstimator, PValueMixin, EffectiveValueMixin, TransferEntropyEstimator

Estimator for the Renyi transfer entropy.

Attributes:
source, destarray_like

The source (X) and dest (Y) data used to estimate the transfer entropy.

kint

The number of nearest neighbors used in the estimation.

alphafloat | int

The Rényi parameter, order or exponent. Sometimes denoted as \(\alpha\) or \(q\).

noise_levelfloat

The standard deviation of the Gaussian noise to add to the data to avoid issues with zero distances.

prop_timeint, optional

Number of positions to shift the data arrays relative to each other (multiple of step_size). Delay/lag/shift between the variables, representing propagation time. Assumed time taken by info to transfer from source to destination. Alternatively called offset.

step_sizeint, optional

Step size between elements for the state space reconstruction.

src_hist_len, dest_hist_lenint, optional

Number of past observations to consider for the source and destination data.

Raises:
ValueError

If the Renyi parameter is not a positive number.

ValueError

If the number of nearest neighbors is not a positive integer.

ValueError

If the step_size is not a non-negative integer.

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.transfer_entropy.TsallisCTEEstimator(source, dest, *, cond=None, k: int = 4, q: float | int = None, noise_level=1e-08, prop_time: int = 0, step_size: int = 1, src_hist_len: int = 1, dest_hist_len: int = 1, cond_hist_len: int = 1, offset: int = None, base: int | float | str = 'e')[source]#

Bases: BaseTsallisTEEstimator, ConditionalTransferEntropyEstimator

Estimator for the Tsallis conditional transfer entropy.

Attributes:
source, dest, condarray_like

The source (X), destination (Y) and conditional (Z) data used to estimate the conditional transfer entropy.

kint

The number of nearest neighbors used in the estimation.

qfloat | int

The Tsallis parameter, order or exponent. Sometimes denoted as \(q\), analogous to the Rényi parameter \(\alpha\).

noise_levelfloat

The standard deviation of the Gaussian noise to add to the data to avoid issues with zero distances.

step_sizeint, optional

Step size between elements for the state space reconstruction.

src_hist_len, dest_hist_len, cond_hist_lenint, optional

Number of past observations to consider for the source, destination and conditional data.

Raises:
ValueError

If the Tsallis parameter is not a positive number.

ValueError

If the number of nearest neighbors is not a positive integer.

ValueError

If the step_size is not a non-negative integer.

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.transfer_entropy.TsallisTEEstimator(source, dest, *, cond=None, k: int = 4, q: float | int = None, noise_level=1e-08, prop_time: int = 0, step_size: int = 1, src_hist_len: int = 1, dest_hist_len: int = 1, cond_hist_len: int = 1, offset: int = None, base: int | float | str = 'e')[source]#

Bases: BaseTsallisTEEstimator, PValueMixin, EffectiveValueMixin, TransferEntropyEstimator

Estimator for the Tsallis transfer entropy.

Attributes:
source, destarray_like

The source (X) and dest (Y) data used to estimate the transfer entropy.

kint

The number of nearest neighbors used in the estimation.

qfloat | int

The Tsallis parameter, order or exponent. Sometimes denoted as \(q\), analogous to the Rényi parameter \(\alpha\).

noise_levelfloat

The standard deviation of the Gaussian noise to add to the data to avoid issues with zero distances.

prop_timeint, optional

Number of positions to shift the data arrays relative to each other (multiple of step_size). Delay/lag/shift between the variables, representing propagation time. Assumed time taken by info to transfer from source to destination. Alternatively called offset.

step_sizeint, optional

Step size between elements for the state space reconstruction.

src_hist_len, dest_hist_lenint, optional

Number of past observations to consider for the source and destination data.

Raises:
ValueError

If the Tsallis parameter is not a positive number.

ValueError

If the number of nearest neighbors is not a positive integer.

ValueError

If the step_size is not a non-negative integer.

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.