2.2.1. Mutual Information (MI) for time delay (tau)

Uses mutual information to find a suitable delay via the location of the first minima in the mutual information vs delay plot, which is calculated using multiple x(t) vs x(t+tau) plots. These plots have their individual mutual information calculated. Various methods for partitioning the x(t) vs x(t+tau) plots for calculating the mutual information.

teaspoon.parameter_selection.MI_delay.MI_DV(x, y)[source]

This function calculates the mutual information between the time series x(t) and its delayed version x(t+tau) using adaptive partitioning of the plots of the time series x(t) and its delayed version x(t+tau). This method was developed by Georges Darbellay and Igor Vajda in 1999 and was published as Estimation of information by an adaptive partitioning of the observation.

Parameters:
  • x (array) – time series x(t)

  • y (array) – delayed time series x(t + tau)

Returns:

I, mutual information between x(t) and x(t+tau).

Return type:

(float)

teaspoon.parameter_selection.MI_delay.MI_basic(x, y, h_method='sturge', ranking=True)[source]

This function calculates the mutual information between the time series x(t) and its delayed version x(t+tau) using equi-spaced partitions. The size of the partition is based on the desired bin size method commonly selected for histograms.

Parameters:
  • x (array) – time series x(t)

  • y (array) – delayed time series x(t + tau)

Kwargs:

h_method (string): bin size selection method. Methods are struge, sqrt, or rice. Default is sturge.

ranking (bool): whether the ranked or unranked x and y inputs will be used. Default is ranking = True.

Returns:

I, mutual information between x(t) and x(t+tau).

Return type:

(float)

teaspoon.parameter_selection.MI_delay.MI_for_delay(ts, plotting=False, method='basic', h_method='sturge', k=2, ranking=True)[source]

This function calculates the mutual information until a first minima is reached, which is estimated as a sufficient embedding dimension for permutation entropy.

Parameters:

ts (array) – Time series (1d).

Kwargs:

plotting (bool): Plotting for user interpretation. defaut is False.

method (string): Method for calculating MI. Options include basic, kraskov 1, kraskov 2, or adaptive partitions. Default is basic.

h_method (string): Bin size selection method for basic method. Methods are struge, sqrt, or rice. Default is sturge.

ranking (bool): Whether the ranked or unranked x and y inputs will be used for kraskov and basic methods. Default is ranking = True.

k (int): Number of nearest neighbors used in MI estimation for Kraskov methods. Default is k = 2.

Returns:

tau, The embedding delay for permutation formation based on first mutual information minima.

Return type:

(int)

teaspoon.parameter_selection.MI_delay.MI_kraskov(x, y, k=2, ranking=True)[source]

This function estimates the mutual information between the time series x(t) and its delayed version x(t+tau) in two different ways. This method was developed by Alexander Kraskov, Harald Stoegbauer, and Peter Grassberger in 2003 and published as Estimating Mutual Information.

Parameters:
  • x (array) – time series x(t)

  • y (array) – delayed time series x(t + tau)

Kwargs:

k (int): number of nearest neighbors used in MI estimation. Default is k = 2.

ranking (bool): whether the ranked or unranked x and y inputs will be used. Default is ranking = True.

Returns:

I1, first mutual information estimation method between x(t) and x(t+tau). (float): I2, second mutual information estimation method between x(t) and x(t+tau).

Return type:

(float)

The following is an example implementing the MI method for selecting tau:

from teaspoon.parameter_selection.MI_delay import MI_for_delay
import numpy as np

fs = 10
t = np.linspace(0, 100, fs*100)
ts = np.sin(t) + np.sin((1/np.pi)*t)

tau = MI_for_delay(ts, plotting = True, method = 'basic', h_method = 'sturge', k = 2, ranking = True)
print('Delay from MI: ',tau)

Where the output for this example is:

Delay from MI:  23