pyhctsa.operations.entropy.permutation_entropy

pyhctsa.operations.entropy.permutation_entropy(y, m=2, tau=1)

Permutation Entropy (PermEn) of a time series.

Computes the permutation entropy and its normalised version for a given time series, as described in [1], along with a weighted permutation entropy [2] and a measure of the time-reversal asymmetry of the ordinal patterns.

The plug-in entropy of pattern counts is biased low by about (m! - 1) / (2 M) nats for M embedding vectors, so it drifts with series length. permEn and normPermEn are therefore the delete-one jackknife estimate of the entropy (Zahl, Ecology 58, 907, 1977, doi:10.2307/1936227; see Paninski, Neural Comput. 15, 1191, 2003, doi:10.1162/089976603321780272, for the bias), computed from the pattern counts alone, so they stay unchanged under strictly increasing transformations of the series. The estimate is nearly unbiased but can exceed its nominal maximum slightly for very short series (normPermEn slightly above 1); it is not clipped, and no minimum length beyond 5 embedding vectors is imposed. permEnLE, normWPE and ordAsym are plug-in quantities.

The permEnLE output follows the adapted implementation of permutation entropy by Bruce Land and Damian Elias (Cornell University; https://people.ece.cornell.edu/land/PROJECTS/Complexity/).

References

Parameters:
y : array-like

Input time series.

m : int, optional

Embedding dimension (order of the permutation entropy). Default is 2.

tau : int or str, optional

Time-delay for the embedding: an integer, or a rule understood by get_tau(): 'ac' (first zero-crossing of the autocorrelation function), 'ac1e' (floor of its first 1/e crossing) or 'mi' (the smaller of the first minimum of the Kraskov automutual information and the 'ac1e' delay), or one of these computed from the ranks of the series ('ac-rank', 'ac1e-rank', 'mi-rank'), with which every output but normWPE (weighted by amplitude) is unchanged by a strictly increasing transformation of the series. All outputs are NaN if the delay cannot be determined (e.g., a constant series). Default is 1.

Returns:

A dictionary containing:

  • ’permEn’: the permutation entropy (bits), as a delete-one jackknife estimate,

  • ’normPermEn’: permEn normalized by log2(m!); like permEn it can exceed its nominal maximum of 1 slightly for short series (not clipped),

  • ’permEnLE’: the permutation entropy of Bandt and Pompe with patterns of probability below 1/N floored at 1/N (natural log, divided by m - 1),

  • ’normWPE’: the weighted permutation entropy normalized by log2(m!) (pattern probabilities are the sums of the variances of the m values of the embedding vectors with that pattern; NaN if all vectors are constant),

  • ’ordAsym’: the total variation distance between the distribution of ordinal patterns of the series and that of the same embedding vectors read backward (0 for a time-reversible pattern distribution).

Return type:

dict