Transfer entropy calculation
Transfer entropy is an information-theoretic measure that quantifies the directed flow of information between two time series. In FaultMap, transfer entropy is used to determine causal relationships between process variables: a high transfer entropy from signal A to signal B indicates that A provides predictive information about B’s future state beyond what B’s own past provides.
FaultMap computes transfer entropy using the
Java Information Dynamics Toolkit (JIDT),
accessed via JPype. The infodynamics module wraps JIDT’s transfer entropy
estimators for use from Python.
Transfer entropy is computed across a range of time delays to identify the lag at which information transfer is strongest. A significance test using surrogate data determines whether the measured transfer entropy is statistically meaningful.
Methods used in the calculation of transfer entropy. A JIDT wrapper.
- faultmap.infodynamics.check_jvm(infodynamics_path)[source]
Check if the Java Virtual Machine (JVM) is started and start it if it is not.
- Parameters:
infodynamics_path (str) – The file path to the infodynamics jar file.
- Returns:
None
- faultmap.infodynamics.setup_te(infodynamics_path, method, **parameters)[source]
Prepares the teCalc class of the Java Infodynamics Toolkit (JIDT) in order to calculate transfer entropy according to the kernel or Kraskov estimator method. Also supports discrete transfer entropy calculation.
- faultmap.infodynamics.calc_te(infodynamics_path, calc_method, affected_data, causal_data, **parameters)[source]
Calculates the transfer entropy for a specific time lag (equal to prediction horizon) between two sets of time series data.
This implementation makes use of the infodynamics toolkit: https://jlizier.github.io/jidt/
The transfer entropy should have a maximum value when time lag = delay used to generate an autoregressive dataset, or will otherwise indicate the dead time between data indicating a causal relationship.
- faultmap.infodynamics.setup_mi_calculator(infodynamics_path, method, **parameters)[source]
Instantiates a mutual information class of the Java Infodynamics Toolkit (JIDT) to calculate mutual information according to the kernel or Kraskov estimator method. Also supports discrete mutual information calculation.
The Kraskov method is the recommended method and also provides methods for auto-embedding. The max corr AIS auto-embedding method will be enabled as the default.
- faultmap.infodynamics.setup_entropy_calculator(infodynamics_path, estimator='kernel', kernel_bandwidth=0.1, multivariate=False)[source]
Instantiates an entropy calculator from a class of the Java Infodynamics Toolkit (JIDT) to calculate differential entropy (continuous signals) according to the estimation method specified.
- Parameters:
infodynamics_path (path) – Location of infodynamics.jar
estimator (string, default='kernel') – Either ‘kernel’ or ‘gaussian’. Specifies the estimator to use in determining the required probability density functions.
kernel_bandwidth (float) – The width of the kernels for the kernel method. If normalisation is performed, these are in terms of standard deviation, otherwise absolute.
multivariate (bool, default=False) – Indicates whether the entropy is to be calculated on a univariate or multivariate signal.
estimator
- Returns:
entropy_calc
- Return type:
EntropyCalculator JIDT object
- faultmap.infodynamics.calc_entropy(entropy_calculator, data, estimator)[source]
Estimates the entropy of a single signal.
- Parameters:
entropy_calculator (EntropyCalculator JIDT object) – The estimation method is determined during initialisation of this object beforehand.
data (one-dimensional numpy.ndarray) – The uni-variate signal.
estimator (Literal['gaussian', 'kernel', 'kozachenko'])
- Returns:
entropy – The entropy of the signal.
- Return type:
Notes
The entropy calculated with the Gaussian estimator is in nats, while that calculated by the kernel estimator is in bits. Nats can be converted to bits by division with ln(2).