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:
ABCBase 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_time
int,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 thecondparameter / conditional TE. Alternatively called offset.- step_size
int,optional Step size between elements for the state space reconstruction.
- src_hist_len, dest_hist_len
int,optional Number of past observations to consider for the source and destination data.
- cond_hist_len
int,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,ConditionalTransferEntropyEstimatorEstimator 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_size
int Step size between elements for the state space reconstruction.
- src_hist_len, dest_hist_len, cond_hist_len
int,optional Number of past observations to consider for the source, destination, and conditional data.
- prop_time
int,optional Not compatible with the
condparameter / 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,TransferEntropyEstimatorEstimator for discrete transfer entropy.
- Attributes:
- source, destarray_like
The source (X) and destination (Y) data used to estimate the transfer entropy.
- prop_time
int,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_size
int Step size between elements for the state space reconstruction.
- src_hist_len, dest_hist_len
int 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,ABCBase 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.
- bandwidth
float|int The bandwidth for the kernel.
- kernel
str Type of kernel to use, compatible with the KDE implementation
kde_probability_density_function().- prop_time
int,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 thecondparameter / conditional TE. Alternatively called offset.- step_size
int,optional Step size between elements for the state space reconstruction.
- src_hist_len, dest_hist_len
int,optional Number of past observations to consider for the source and destination data.
- cond_hist_len
int,optional Number of past observations to consider for the conditional data. Only used for conditional transfer entropy.
- 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.
- 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,ConditionalTransferEntropyEstimatorEstimator 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.
- bandwidth
float|int The bandwidth for the kernel.
- kernel
str Type of kernel to use, compatible with the KDE implementation
kde_probability_density_function().- step_size
int Step size between elements for the state space reconstruction.
- src_hist_len, dest_hist_len, cond_hist_len
int,optional Number of past observations to consider for the source, destination, and conditional data.
- prop_time
int,optional Not compatible with the
condparameter / conditional TE.
Notes
A small
bandwidthcan lead to under-sampling, while a largebandwidthmay 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,TransferEntropyEstimatorEstimator 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.
- bandwidth
float|int The bandwidth for the kernel.
- kernel
str Type of kernel to use, compatible with the KDE implementation
kde_probability_density_function().- prop_time
int,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_size
int Step size between elements for the state space reconstruction.
- src_hist_len, dest_hist_len
int Number of past observations to consider for the source and destination data.
Notes
A small
bandwidthcan lead to under-sampling, while a largebandwidthmay 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:
ABCBase 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.
- k
int Number of nearest neighbors to consider.
- noise_level
float,NoneorFalse Standard deviation of Gaussian noise to add to the data. Adds \(\mathcal{N}(0, \text{noise}^2)\) to each data point.
- 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.
- prop_time
int,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 thecondparameter / conditional TE. Alternatively called offset.- step_size
int,optional Step size between elements for the state space reconstruction.
- src_hist_len, dest_hist_len
int,optional Number of past observations to consider for the source and destination data.
- cond_hist_len
int,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,ConditionalTransferEntropyEstimatorEstimator 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.
- k
int Number of nearest neighbors to consider.
- noise_level
float,NoneorFalse Standard deviation of Gaussian noise to add to the data. Adds \(\mathcal{N}(0, ext{noise}^2)\) to each data point.
- 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.
- step_size
int Step size between elements for the state space reconstruction.
- src_hist_len, dest_hist_len, cond_hist_len
int,optional Number of past observations to consider for the source, destination, and conditional data.
- prop_time
int,optional Not compatible with the
condparameter / conditional TE.
Notes
Changing the number of nearest neighbors
kcan 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,TransferEntropyEstimatorEstimator 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.
- k
int Number of nearest neighbors to consider.
- noise_level
float,NoneorFalse Standard deviation of Gaussian noise to add to the data. Adds \(\mathcal{N}(0, \text{noise}^2)\) to each data point.
- 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.
- prop_time
int,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_size
int,optional Step size between elements for the state space reconstruction.
- src_hist_len, dest_hist_len
int Number of past observations to consider for the source and destination data.
Notes
Changing the number of nearest neighbors
kcan 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:
ABCBase 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_dim
int 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_time
int,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 thecondparameter / conditional TE. Alternatively called offset.- step_size
int,optional Step size between elements for the state space reconstruction.
- src_hist_len, dest_hist_len
int,optional Number of past observations to consider for the source and destination data.
- cond_hist_len
int,optional Number of past observations to consider for the conditional data. Only used for conditional transfer entropy.
- Raises:
ValueErrorIf the
embedding_dimis negative or not an integer.ValueErrorIf the
embedding_dimis too large for the given data.ValueErrorIf
step_size,prop_time, andembedding_dimare such that the data is too small.TypeErrorIf the data are not 1d array-like(s).
Notes
If
embedding_dimis 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,ConditionalTransferEntropyEstimatorEstimator 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_dim
int The size of the permutation patterns.
- prop_time
int,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_size
int Step size between elements for the state space reconstruction.
- src_hist_len, dest_hist_len, cond_hist_len
int Number of past observations to consider for the source, destination, and conditional data.
- Raises:
ValueErrorIf the
embedding_dimis negative or not an integer.ValueErrorIf the
embedding_dimis too large for the given data.ValueErrorIf
step_size,prop_time, andembedding_dimare such that the data is too small.
Notes
If
embedding_dimis 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,TransferEntropyEstimatorEstimator for the Ordinal / Permutation transfer entropy.
- Attributes:
- source, destarray_like
The source (X) and dest (Y) data used to estimate the transfer entropy.
- embedding_dim
int The size of the permutation patterns.
- prop_time
int,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_size
int Step size between elements for the state space reconstruction.
- src_hist_len, dest_hist_len
int Number of past observations to consider for the source and destination data.
- Raises:
ValueErrorIf the
embedding_dimis negative or not an integer.ValueErrorIf the
embedding_dimis too large for the given data.ValueErrorIf
step_size,prop_time, andembedding_dimare such that the data is too small.
Notes
If
embedding_dimis 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:
ABCBase 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.
- 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.
- prop_time
int,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 thecondparameter / conditional TE. Alternatively called offset.- step_size
int,optional Step size between elements for the state space reconstruction.
- src_hist_len, dest_hist_len
int,optional Number of past observations to consider for the source and destination data.
- cond_hist_len
int,optional Number of past observations to consider for the conditional data. Only used for conditional transfer entropy.
- Raises:
ValueErrorIf the Renyi parameter is not a positive number.
ValueErrorIf the number of nearest neighbors is not a positive integer.
ValueErrorIf 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,ConditionalTransferEntropyEstimatorEstimator 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.
- 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.
- step_size
int Step size between elements for the state space reconstruction.
- src_hist_len, dest_hist_len, cond_hist_len
int Number of past observations to consider for the source, destination, and conditional data.
- Raises:
ValueErrorIf the Renyi parameter is not a positive number.
ValueErrorIf the number of nearest neighbors is not a positive integer.
ValueErrorIf 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,TransferEntropyEstimatorEstimator for the Renyi transfer entropy.
- Attributes:
- source, destarray_like
The source (X) and dest (Y) data used to estimate the transfer entropy.
- 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.
- prop_time
int,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_size
int,optional Step size between elements for the state space reconstruction.
- src_hist_len, dest_hist_len
int,optional Number of past observations to consider for the source and destination data.
- Raises:
ValueErrorIf the Renyi parameter is not a positive number.
ValueErrorIf the number of nearest neighbors is not a positive integer.
ValueErrorIf 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:
ABCBase 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.
- k
int The number of nearest neighbors used in the estimation.
- 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.
- prop_time
int,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 thecondparameter / conditional TE. Alternatively called offset.- step_size
int,optional Step size between elements for the state space reconstruction.
- src_hist_len, dest_hist_len
int,optional Number of past observations to consider for the source and destination data.
- cond_hist_len
int,optional Number of past observations to consider for the conditional data. Only used for conditional transfer entropy.
- Raises:
ValueErrorIf the Tsallis parameter is not a positive number.
ValueErrorIf the number of nearest neighbors is not a positive integer.
ValueErrorIf 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,ConditionalTransferEntropyEstimatorEstimator 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.
- k
int The number of nearest neighbors used in the estimation.
- 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.
- step_size
int,optional Step size between elements for the state space reconstruction.
- src_hist_len, dest_hist_len, cond_hist_len
int,optional Number of past observations to consider for the source, destination and conditional data.
- Raises:
ValueErrorIf the Tsallis parameter is not a positive number.
ValueErrorIf the number of nearest neighbors is not a positive integer.
ValueErrorIf 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,TransferEntropyEstimatorEstimator for the Tsallis transfer entropy.
- Attributes:
- source, destarray_like
The source (X) and dest (Y) data used to estimate the transfer entropy.
- k
int The number of nearest neighbors used in the estimation.
- 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.
- prop_time
int,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_size
int,optional Step size between elements for the state space reconstruction.
- src_hist_len, dest_hist_len
int,optional Number of past observations to consider for the source and destination data.
- Raises:
ValueErrorIf the Tsallis parameter is not a positive number.
ValueErrorIf the number of nearest neighbors is not a positive integer.
ValueErrorIf 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,ConditionalTransferEntropyEstimatorEstimator 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_size
int Step size between elements for the state space reconstruction.
- src_hist_len, dest_hist_len, cond_hist_len
int,optional Number of past observations to consider for the source, destination, and conditional data.
- prop_time
int,optional Not compatible with the
condparameter / 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,TransferEntropyEstimatorEstimator for discrete transfer entropy.
- Attributes:
- source, destarray_like
The source (X) and destination (Y) data used to estimate the transfer entropy.
- prop_time
int,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_size
int Step size between elements for the state space reconstruction.
- src_hist_len, dest_hist_len
int 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,ConditionalTransferEntropyEstimatorEstimator 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.
- k
int Number of nearest neighbors to consider.
- noise_level
float,NoneorFalse Standard deviation of Gaussian noise to add to the data. Adds \(\mathcal{N}(0, ext{noise}^2)\) to each data point.
- 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.
- step_size
int Step size between elements for the state space reconstruction.
- src_hist_len, dest_hist_len, cond_hist_len
int,optional Number of past observations to consider for the source, destination, and conditional data.
- prop_time
int,optional Not compatible with the
condparameter / conditional TE.
Notes
Changing the number of nearest neighbors
kcan 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,TransferEntropyEstimatorEstimator 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.
- k
int Number of nearest neighbors to consider.
- noise_level
float,NoneorFalse Standard deviation of Gaussian noise to add to the data. Adds \(\mathcal{N}(0, \text{noise}^2)\) to each data point.
- 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.
- prop_time
int,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_size
int,optional Step size between elements for the state space reconstruction.
- src_hist_len, dest_hist_len
int Number of past observations to consider for the source and destination data.
Notes
Changing the number of nearest neighbors
kcan 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,ConditionalTransferEntropyEstimatorEstimator 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.
- bandwidth
float|int The bandwidth for the kernel.
- kernel
str Type of kernel to use, compatible with the KDE implementation
kde_probability_density_function().- step_size
int Step size between elements for the state space reconstruction.
- src_hist_len, dest_hist_len, cond_hist_len
int,optional Number of past observations to consider for the source, destination, and conditional data.
- prop_time
int,optional Not compatible with the
condparameter / conditional TE.
Notes
A small
bandwidthcan lead to under-sampling, while a largebandwidthmay 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,TransferEntropyEstimatorEstimator 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.
- bandwidth
float|int The bandwidth for the kernel.
- kernel
str Type of kernel to use, compatible with the KDE implementation
kde_probability_density_function().- prop_time
int,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_size
int Step size between elements for the state space reconstruction.
- src_hist_len, dest_hist_len
int Number of past observations to consider for the source and destination data.
Notes
A small
bandwidthcan lead to under-sampling, while a largebandwidthmay 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,ConditionalTransferEntropyEstimatorEstimator 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_dim
int The size of the permutation patterns.
- prop_time
int,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_size
int Step size between elements for the state space reconstruction.
- src_hist_len, dest_hist_len, cond_hist_len
int Number of past observations to consider for the source, destination, and conditional data.
- Raises:
ValueErrorIf the
embedding_dimis negative or not an integer.ValueErrorIf the
embedding_dimis too large for the given data.ValueErrorIf
step_size,prop_time, andembedding_dimare such that the data is too small.
Notes
If
embedding_dimis 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,TransferEntropyEstimatorEstimator for the Ordinal / Permutation transfer entropy.
- Attributes:
- source, destarray_like
The source (X) and dest (Y) data used to estimate the transfer entropy.
- embedding_dim
int The size of the permutation patterns.
- prop_time
int,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_size
int Step size between elements for the state space reconstruction.
- src_hist_len, dest_hist_len
int Number of past observations to consider for the source and destination data.
- Raises:
ValueErrorIf the
embedding_dimis negative or not an integer.ValueErrorIf the
embedding_dimis too large for the given data.ValueErrorIf
step_size,prop_time, andembedding_dimare such that the data is too small.
Notes
If
embedding_dimis 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,ConditionalTransferEntropyEstimatorEstimator 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.
- 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.
- step_size
int Step size between elements for the state space reconstruction.
- src_hist_len, dest_hist_len, cond_hist_len
int Number of past observations to consider for the source, destination, and conditional data.
- Raises:
ValueErrorIf the Renyi parameter is not a positive number.
ValueErrorIf the number of nearest neighbors is not a positive integer.
ValueErrorIf 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,TransferEntropyEstimatorEstimator for the Renyi transfer entropy.
- Attributes:
- source, destarray_like
The source (X) and dest (Y) data used to estimate the transfer entropy.
- 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.
- prop_time
int,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_size
int,optional Step size between elements for the state space reconstruction.
- src_hist_len, dest_hist_len
int,optional Number of past observations to consider for the source and destination data.
- Raises:
ValueErrorIf the Renyi parameter is not a positive number.
ValueErrorIf the number of nearest neighbors is not a positive integer.
ValueErrorIf 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,ConditionalTransferEntropyEstimatorEstimator 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.
- k
int The number of nearest neighbors used in the estimation.
- 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.
- step_size
int,optional Step size between elements for the state space reconstruction.
- src_hist_len, dest_hist_len, cond_hist_len
int,optional Number of past observations to consider for the source, destination and conditional data.
- Raises:
ValueErrorIf the Tsallis parameter is not a positive number.
ValueErrorIf the number of nearest neighbors is not a positive integer.
ValueErrorIf 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,TransferEntropyEstimatorEstimator for the Tsallis transfer entropy.
- Attributes:
- source, destarray_like
The source (X) and dest (Y) data used to estimate the transfer entropy.
- k
int The number of nearest neighbors used in the estimation.
- 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.
- prop_time
int,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_size
int,optional Step size between elements for the state space reconstruction.
- src_hist_len, dest_hist_len
int,optional Number of past observations to consider for the source and destination data.
- Raises:
ValueErrorIf the Tsallis parameter is not a positive number.
ValueErrorIf the number of nearest neighbors is not a positive integer.
ValueErrorIf 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.