KSGCTEEstimator#
- class infomeasure.estimators.transfer_entropy.KSGCTEEstimator(source, dest, *, cond=None, k: int = 4, ksg_id: int = 1, 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', **kwargs)[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
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].