# Base Entropies

## Functions for estimating the entropy of a single univariate time series.

The following functions also form the base entropy method used by multiscale entropy functions.

These functions are directly available when EntropyHub is imported:

```import EntropyHub as EH

dir(EH)
```

ApEn(Sig, m=2, tau=1, r=None, Logx=numpy.exp)

ApEn estimates the approximate entropy of a univariate data sequence.

```Ap, Phi = ApEn(Sig)
```

Returns the approximate entropy estimates (`Ap`) and the log-average number of matched vectors (`Phi`) for `m` = [0,1,2], estimated for the data sequence (`Sig`) using the default parameters: embedding dimension = 2, time delay = 1, radius threshold = 0.2*SD(`Sig`), logarithm = natural

```Ap, Phi = ApEn(Sig, keyword = value, ...)
```

Returns the approximate entropy estimates (`Ap`) of the data sequence (`Sig`) for dimensions = [0, 1, …, `m`] using the specified keyword arguments:

m:
• Embedding Dimension, a positive integer

tau:
• Time Delay, a positive integer

r:
• Radius Distance Threshold, a positive scalar

Logx:
• Logarithm base, a positive scalar

`XApEn`, `SampEn`, `MSEn`, `FuzzEn`, `PermEn`, `CondEn`, `DispEn`

References:
[1] Steven M. Pincus,

“Approximate entropy as a measure of system complexity.” Proceedings of the National Academy of Sciences 88.6 (1991): 2297-2301.

AttnEn(Sig, Logx=2)

AttnEn estimates the attention entropy of a univariate data sequence.

```Attn, (Hxx, Hnn, Hxn, Hnx) = AttnEn(Sig)
```

Returns the attention entropy (`Attn`) calculated as the average of the sub-entropies (`Hxx`, `Hxn`, `Hnn`, `Hnx`) estimated from the data sequence (`Sig`) using a base-2 logarithm.

```Attn, (Hxx, Hnn, Hxn, Hnx) = AttnEn(Sig, Logx = value)
```

Returns the attention entropy (`Attn`) and a four-element tuple of sub-entropies (`Hxx`, `Hnn`, `Hxn`, `Hnx`) from the data sequence (`Sig`) where,

Hxx:
• entropy of local-maxima intervals

Hnn:
• entropy of local minima intervals

Hxn:
• entropy of intervals between local maxima and subsequent minima

Hnx:
• entropy of intervals between local minima and subsequent maxima using the following keyword argument:

Logx:
• Logarithm base, a positive scalar (enter 0 for natural log)

`EnofEn`, `SpecEn`, `XSpecEn`, `PermEn`, `MSEn`

References:
[1] Jiawei Yang, et al.,

“Classification of Interbeat Interval Time-series Using Attention Entropy.” IEEE Transactions on Affective Computing (2020)

BubbEn(Sig, m=2, tau=1, Logx=numpy.exp)

BubbEn estimates the bubble entropy of a univariate data sequence.

```Bubb, H = BubbEn(Sig)
```

Returns the bubble entropy (`Bubb`) and the conditional Rényi entropy (`H`) estimate from the data sequence (`Sig`) using the default parameters: embedding dimension = 2, time delay = 1, logarithm = natural

```Bubb, H = BubbEn(Sig, keyword = value, ...)
```

Returns the bubble entropy (`Bubb`) estimated from the data sequence (`Sig`) using the specified ‘keyword’ arguments:

m:
• Embedding Dimension, an integer > 1

BubbEn returns estimates for each dimension [2, …, `m`]

tau:
• Time Delay, a positive integer

Logx:
• Logarithm base, a positive scalar

`PhasEn`, `MSEn`

References:
[1] George Manis, M.D. Aktaruzzaman and Roberto Sassi,

“Bubble entropy: An entropy almost free of parameters.” IEEE Transactions on Biomedical Engineering 64.11 (2017): 2711-2718.

CoSiEn(Sig, m=2, tau=1, r=0.1, Logx=2, Norm=0)

CoSiEn estimates the cosine similarity entropy of a univariate data sequence.

```CoSi, Bm = CoSiEn(Sig)
```

Returns the cosine similarity entropy (`CoSi`) and the corresponding global probabilities (`Bm`) estimated from the data sequence (`Sig`) using the default parameters: embedding dimension = 2, time delay = 1, angular threshold = .1, logarithm = base 2,

```CoSi, Bm = CoSiEn(Sig, keyword = value, ...)
```

Returns the cosine similarity entropy (`CoSi`) estimated from the data sequence (`Sig`) using the specified ‘keyword’ arguments:

m:
• Embedding Dimension, an integer > 1

tau:
• Time Delay, a positive integer

r:
• Angular threshold, a value in range [0 < `r` < 1]

Logx:
• Logarithm base, a positive scalar (enter 0 for natural log)

Norm:
• Normalisation of `Sig`, one of the following integers:

1. no normalisation - default

2. normalises `Sig` by removing median(`Sig`)

3. normalises `Sig` by removing mean(`Sig`)

4. normalises `Sig` w.r.t. SD(`Sig`)

5. normalises `Sig` values to range [-1 1]

`PhasEn`, `SlopEn`, `GridEn`, `MSEn`, `hMSEn`

References:
[1] Theerasak Chanwimalueang and Danilo Mandic,

“Cosine similarity entropy: Self-correlation-based complexity analysis of dynamical systems.” Entropy 19.12 (2017): 652.

CondEn(Sig, m=2, tau=1, c=6, Logx=numpy.exp, Norm=False)

CondEn estimates the corrected conditional entropy of a univariate data sequence.

```Cond, SEw, SEz = CondEn(Sig)
```

Returns the corrected conditional entropy estimates (`Cond`) and the corresponding Shannon entropies (`m`: `SEw`, `m+1`: `SEz`) for `m` = [1,2] estimated from the data sequence (`Sig`) using the default parameters: embedding dimension = 2, time delay = 1, symbols = 6, logarithm = natural, normalisation = False Note: `CondEn(m=1)` returns the Shannon entropy of `Sig`.

```Cond, SEw, SEz = CondEn(Sig, keyword = value, ...)
```

Returns the corrected conditional entropy estimates (Cond) from the data sequence (Sig) using the specified ‘keyword’ arguments:

m:
• Embedding Dimension, an integer > 1

tau:
• Time Delay, a positive integer

c:
• Number of symbols, an integer > 1

Logx:
• Logarithm base, a positive scalar

Norm:
• Normalisation of `Cond` value, a boolean:

• `False` no normalisation - default

• `True` normalises w.r.t Shannon entropy of data sequence `Sig`.

`XCondEn`, `MSEn`, `PermEn`, `DistEn`, `XPermEn`

References:
[1] Alberto Porta, et al.,

“Measuring regularity by means of a corrected conditional entropy in sympathetic outflow.” Biological cybernetics 78.1 (1998): 71-78.

DispEn(Sig, m=2, tau=1, c=3, Typex='NCDF', Logx=numpy.exp, Fluct=False, Norm=False, rho=1)

DispEn estimates the dispersion entropy of a univariate data sequence.

```Dispx, Ppi = DispEn(Sig)
```

Returns the dispersion entropy (`Dispx`) and the reverse dispersion entropy (`RDE`) estimated from the data sequence (`Sig`) using the default parameters: embedding dimension = 2, time delay = 1, symbols = 3, logarithm = natural, data transform = normalised cumulative density function (ncdf)

```Dispx, Ppi = DispEn(Sig, keyword = value, ...)
```

Returns the dispersion entropy (`Dispx`) and the reverse dispersion entropy (`RDE`) estimated from the data sequence (`Sig`) using the specified ‘keyword’ arguments:

m:
• Embedding Dimension, a positive integer

tau:
• Time Delay, a positive integer

c:
• Number of symbols, an integer > 1

Typex:
• Typex of data-to-symbolic sequence transform, one of the following strings: {`'linear'`, `'kmeans'`, `'ncdf'`, `'finesort'`, `'equal'`}

Logx:
• Logarithm base, a positive scalar

Fluct:
• When `Fluct == True`, DispEn returns the fluctuation-based Dispersion entropy. [default: False]

Norm:
• Normalisation of `Dispx` and `RDE` values, a boolean:

• `False` no normalisation - default

• `True` normalises w.r.t # possible vector permutations

(`c^m` or `(2c -1)^m-1` if `Fluct == True`).

rho:
• *If `Typex == 'finesort'`, rho is the tuning parameter (default: 1)

`PermEn`, `SyDyEn`, `MSEn`.

References:
[1] Mostafa Rostaghi and Hamed Azami,

“Dispersion entropy: A measure for time-series analysis.” IEEE Signal Processing Letters 23.5 (2016): 610-614.

[2] Hamed Azami and Javier Escudero,

“Amplitude-and fluctuation-based dispersion entropy.” Entropy 20.3 (2018): 210.

[3] Li Yuxing, Xiang Gao and Long Wang,

“Reverse dispersion entropy: A new complexity measure for sensor signal.” Sensors 19.23 (2019): 5203.

[4] Wenlong Fu, et al.,

“Fault diagnosis for rolling bearings based on fine-sorted dispersion entropy and SVM optimized with mutation SCA-PSO.” Entropy 21.4 (2019): 404.

DistEn(Sig, m=2, tau=1, Bins='Sturges', Logx=2, Norm=True)

DistEn estimates the distribution entropy of a univariate data sequence.

```Dist, Ppi = DistEn(Sig)
```

Returns the distribution entropy estimate (`Dist`) and the corresponding distribution probabilities (`Ppi`) estimated from the data sequence (`Sig`) using the default parameters: embedding dimension = 2, time delay = 1, binning method = ‘Sturges’, logarithm = base 2, normalisation = w.r.t # of histogram bins

```Dist, Ppi = DistEn(Sig, keyword = value, ...)
```

Returns the distribution entropy estimate (`Dist`) estimated from the data sequence (`Sig`) using the specified ‘keyword’ arguments:

m:
• Embedding Dimension, a positive integer

tau:
• Time Delay, a positive integer

Bins:
• Histogram bin selection method for distance distribution, one of the following:

• an integer > 1 indicating the number of bins,

• or one of the following strings {`'sturges'`, `'sqrt'`, `'rice'`, `'doanes'`} [default: `'sturges'`]

Logx:
• Logarithm base, a positive scalar (enter 0 for natural log)

Norm:
• Normalisation of `Dist` value, a boolean:

• [False] no normalisation.

• [True] normalises w.r.t # of histogram bins - default

`XDistEn`, `DistEn2D`, `MSEn`, `K2En`

References:
[1] Li, Peng, et al.,

“Assessing the complexity of short-term heartbeat interval series by distribution entropy.” Medical & biological engineering & computing 53.1 (2015): 77-87.

DivEn(Sig, m=2, tau=1, r=5, Logx=numpy.exp)

DivEn estimates the diversity entropy of a univariate data sequence.

```Div, CDEn, Bm = DivEn(Sig)
```

Returns the diversity entropy (`Div`), the cumulative diversity entropy (`CDEn`), and the corresponding probabilities (`Bm`) estimated from the data sequence (`Sig`) using the default parameters: embedding dimension = 2, time delay = 1, # bins = 5, logarithm = natural,

```Div, CDEn, Bm = DivEn(Sig, keyword = value, ...)
```

Returns the diversity entropy (`Div`) estimated from the data sequence (`Sig`) using the specified ‘keyword’ arguments:

m:
• Embedding Dimension, an integer > 1

tau:
• Time Delay, a positive integer

r:
• Histogram bins #: either

• an integer [1 < `r`] representing the number of bins

• a list/numpy array of 3 or more increasing values in range [-1 1] representing the bin edges including the rightmost edge.

Logx:
• Logarithm base, a positive scalar (enter 0 for natural log)

`CoSiEn`, `PhasEn`, `SlopEn`, `GridEn`, `MSEn`

References:
[1] X. Wang, S. Si and Y. Li,

“Multiscale Diversity Entropy: A Novel Dynamical Measure for Fault Diagnosis of Rotating Machinery,” IEEE Transactions on Industrial Informatics, vol. 17, no. 8, pp. 5419-5429, Aug. 2021

[2] Y. Wang, M. Liu, Y. Guo, F. Shu, C. Chen and W. Chen,

“Cumulative Diversity Pattern Entropy (CDEn): A High-Performance, Almost-Parameter-Free Complexity Estimator for Nonstationary Time Series,” IEEE Transactions on Industrial Informatics vol. 19, no. 9, pp. 9642-9653, Sept. 2023

EnofEn(Sig, tau=10, S=10, Xrange=None, Logx=numpy.exp)

EnofEn estimates the entropy of entropy of a univariate data sequence.

```EoE, AvEn, S2 = EnofEn(Sig)
```

Returns the entropy of entropy (`EoE`), the average Shannon entropy across all windows (`AvEn`), and the number of levels (`S2`) estimated from the data sequence (`Sig`) using the default parameters: window length (samples) = 10, slices = 10, logarithm = natural heartbeat interval range (xmin, xmax) = (min(Sig), max(Sig))

```EoE, AvEn, S2 = EnofEn(Sig, keyword = value, ...)
```

Returns the entropy of entropy (`EoE`) estimated from the data sequence (`Sig`) using the specified ‘keyword’ arguments:

tau:
• Window length, an integer > 1

S:
• Number of slices, an integer > 1

Xrange:
• The min and max heartbeat interval, a two-element tuple where X[0] < X[1]

Logx:
• Logarithm base, a positive scalar

`SampEn`, `MSEn`

References:
[1] Chang Francis Hsu, et al.,

“Entropy of entropy: Measurement of dynamical complexity for biological systems.” Entropy 19.10 (2017): 550.

FuzzEn(Sig, m=2, tau=1, r=(0.2, 2.0), Fx='default', Logx=numpy.exp)

FuzzEn estimates the fuzzy entropy of a univariate data sequence.

```Fuzz, Ps1, Ps2 = FuzzEn(Sig)
```

Returns the fuzzy entropy estimates (`Fuzz`) and the average fuzzy distances (`m`: `Ps1`, `m+1`: `Ps2`) for `m` = [1,2] estimated from the data sequence (`Sig`) using the default parameters: embedding dimension = 2, time delay = 1, fuzzy function (`Fx`) = `'default'`, fuzzy function parameters (`r`) = (0.2, 2), logarithm = natural

```Fuzz, Ps1, Ps2 = FuzzEn(Sig, keyword = value, ...)
```

Returns the fuzzy entropy estimates (`Fuzz`) for dimensions = [1, …, `m`] estimated for the data sequence (`Sig`) using the specified name/value pair arguments:

m:
• Embedding Dimension, a positive integer [default: 2]

tau:
• Time Delay, a positive integer [default: 1]

Fx:
• Fuzzy function name, one of the following strings:

{`'sigmoid'`, `'modsampen'`, `'default'`, `'gudermannian'`, `'bell'`, `'triangular'`, `'trapezoidal1'`, `'trapezoidal2'`, `'z_shaped'`, `'gaussian'`, `'constgaussian'`}

r:
• Fuzzy function parameters, a 1 element scalar or a 2 element vector of positive values.

The `r` parameters for each fuzzy function are defined as follows: [default: (.2 2)] - default: [Tuple]

• r[0] = divisor of the exponential argument

• r[1] = argument exponent (pre-division)

• sigmoid: [Tuple]
• r[0] = divisor of the exponential argument

• r[1] = value subtracted from argument (pre-division)

• modsampen: [Tuple]
• r[0] = divisor of the exponential argument

• r[1] = value subtracted from argument (pre-division)

• gudermannian:
• r = a scalar whose value is the numerator of argument to gudermannian function: GD(x) = atan(tanh(r/x)). GD(x) is normalised to have a maximum value of 1.

• triangular:
• r = a scalar whose value is the threshold (corner point) of the triangular function.

• trapezoidal1:
• r = a scalar whose value corresponds to the upper (2r) and lower (r) corner points of the trapezoid.

• trapezoidal2: [Tuple]
• r[0] = a value corresponding to the upper corner point of the trapezoid.

• r[1] = a value corresponding to the lower corner point of the trapezoid.

• z_shaped:
• r = a scalar whose value corresponds to the upper (2r) and lower (r) corner points of the z-shape.

• bell:
• r[0] = divisor of the distance value

• r[1] = exponent of generalized bell-shaped function

• gaussian:
• r = a scalar whose value scales the slope of the Gaussian curve.

• constgaussian:
• r = a scalar whose value defines the lower threshod and shape of the Gaussian curve.

• [DEPRICATED] linear:

r = an integer value. When r = 0, the argument of the exponential function is normalised between [0 1]. When r = 1, the minimuum value of the exponential argument is set to 0.

Logx:
• Logarithm base, a positive scalar [default: natural]

For further information on the keyword arguments, see the EntropyHub guide.

`SampEn`, `ApEn`, `PermEn`, `DispEn`, `XFuzzEn`, `FuzzEn2D`, `MSEn`

References:
[1] Weiting Chen, et al.

“Characterization of surface EMG signal based on fuzzy entropy.” IEEE Transactions on neural systems and rehabilitation engineering 15.2 (2007): 266-272.

[2] Hong-Bo Xie, Wei-Xing He, and Hui Liu

“Measuring time series regularity using nonlinear similarity-based sample entropy.” Physics Letters A 372.48 (2008): 7140-7146.

[3] Hamed Azami, et al.

“Fuzzy Entropy Metrics for the Analysis of Biomedical Signals: Assessment and Comparison” IEEE Access 7 (2019): 104833-104847

GridEn(Sig, m=3, tau=1, Logx=numpy.exp, Plotx=False)

GridEn estimates the gridded distribution entropy of a univariate data sequence.

```GDE, GDR, _ = GridEn(Sig)
```

Returns the gridded distribution entropy (`GDE`) and the gridded distribution rate (`GDR`) estimated from the data sequence (`Sig`) using the default parameters: grid coarse-grain = 3, time delay = 1, logarithm = base 2

```GDE, GDR, PIx, GIx, SIx, AIx = GridEn(Sig, keyword = value)
```

Returns the gridded distribution entropy (`GDE`) estimated from the data sequence (`Sig`) using the specified ‘keyword’ arguments:

m:
• Grid coarse-grain (m x m sectors), an integer > 1

tau:
• Time Delay, a positive integer

Logx:
• Logarithm base, a positive scalar

Plotx:
• When `Plotx == True`, returns gridded Poicaré plot and a bivariate histogram of the grid point distribution (default: False)

`PhasEn`, `CoSiEn`, `SlopEn`, `BubbEn`, `MSEn`

References:
[1] Chang Yan, et al.,

“Novel gridded descriptors of poincaré plot for analyzing heartbeat interval time-series.” Computers in biology and medicine 109 (2019): 280-289.

[2] Chang Yan, et al.

“Area asymmetry of heart rate variability signal.” Biomedical engineering online 16.1 (2017): 1-14.

[3] Alberto Porta, et al.,

“Temporal asymmetries of short-term heart period variability are linked to autonomic regulation.” American Journal of Physiology-Regulatory, Integrative and Comparative Physiology 295.2 (2008): R550-R557.

[4] C.K. Karmakar, A.H. Khandoker and M. Palaniswami,

“Phase asymmetry of heart rate variability signal.” Physiological measurement 36.2 (2015): 303.

IncrEn(Sig, m=2, tau=1, R=4, Logx=2, Norm=False)

IncrEn estimates the increment entropy of a univariate data sequence.

```Incr = IncrEn(Sig)
```

Returns the increment entropy (`Incr`) estimate of the data sequence (`Sig`) using the default parameters: embedding dimension = 2, time delay = 1, quantifying resolution = 4, logarithm = base 2,

```Incr = IncrEn(Sig, keyword = value, ...)
```

Returns the increment entropy (`Incr`) estimate of the data sequence (`Sig`) using the specified ‘keyword’ arguments:

m:
• Embedding Dimension, an integer > 1

tau:
• Time Delay, a positive integer

R:
• Quantifying resolution, a positive scalar

Logx:
• Logarithm base, a positive scalar (enter 0 for natural log)

Norm:
• Normalisation of `IncrEn` value, a boolean:

• [False] no normalisation - default

• [True] normalises w.r.t embedding dimension (m-1).

`PermEn`, `SyDyEn`, `MSEn`

References:
[1] Xiaofeng Liu, et al.,

“Increment entropy as a measure of complexity for time series.” Entropy 18.1 (2016): 22.1.

*** “Correction on Liu, X.; Jiang, A.; Xu, N.; Xue, J. - Increment

Entropy as a Measure of Complexity for Time Series, Entropy 2016, 18, 22.” Entropy 18.4 (2016): 133.

[2] Xiaofeng Liu, et al.,

“Appropriate use of the increment entropy for electrophysiological time series.” Computers in biology and medicine 95 (2018): 13-23.

K2En(Sig, m=2, tau=1, r=None, Logx=numpy.exp)

K2En estimates the Kolmogorov (K2) entropy of a univariate data sequence.

```K2, Ci = K2En(Sig)
```

Returns the Kolmogorov entropy estimates (`K2`) and the correlation integrals (`Ci`) for `m` = [1,2] estimated from the data sequence (`Sig`) using the default parameters: embedding dimension = 2, time delay = 1, distance threshold (`r`) = 0.2*SD(`Sig`), logarithm = natural

```K2, Ci = K2En(Sig, keyword = value, ...)
```

Returns the Kolmogorov entropy estimates (`K2`) for dimensions = [1, …, `m`] estimated from the data sequence (`Sig`) using the ‘keyword’ arguments:

m:
• Embedding Dimension, a positive integer

tau:
• Time Delay, a positive integer

r:
• Radius Distance Threshold, a positive scalar

Logx:
• Logarithm base, a positive scalar

`DistEn`, `XK2En`, `MSEn`

References:
[1] Peter Grassberger and Itamar Procaccia,

“Estimation of the Kolmogorov entropy from a chaotic signal.” Physical review A 28.4 (1983): 2591.

[2] Lin Gao, Jue Wang and Longwei Chen

“Event-related desynchronization and synchronization quantification in motor-related EEG by Kolmogorov entropy” J Neural Eng. 2013 Jun;10(3):03602

PermEn(Sig, m=2, tau=1, Logx=2, Norm=False, Typex='none', tpx=-1)

PermEn estimates the permutation entropy of a univariate data sequence.

```Perm, Pnorm, cPE = PermEn(Sig)
```

Returns the permuation entropy estimates (`Perm`), the normalised permutation entropy (`Pnorm`) and the conditional permutation entropy (`cPE`) for `m` = [1,2] estimated from the data sequence (`Sig`) using the default parameters: embedding dimension = 2, time delay = 1, logarithm = base 2, normalisation = w.r.t #symbols (`m-1`) Note: using the standard PermEn estimation, `Perm` =0 when `m` =1. It is recommeneded that signal length, N > 5m! (see [8] and Amigo et al., Europhys. Lett. 83:60005, 2008)

```Perm, Pnorm, cPE = PermEn(Sig, m)
```

Returns the permutation entropy estimates (`Perm`) estimated from the data sequence (`Sig`) using the specified embedding dimensions = [1,…, `m`] with other default parameters as listed above.

```Perm, Pnorm, cPE = PermEn(Sig, keyword = value, ...)
```

Returns the permutation entropy estimates (`Perm`) for dimensions = [1,…, `m`] estimated from the data sequence (`Sig`) using the specified ‘keyword’ arguments:

m:
• Embedding Dimension, an integer > 1

tau:
• Time Delay, a positive integer

Logx:
• Logarithm base, a positive scalar (enter 0 for natural log)

Norm:
• Normalisation of `Pnorm` value, a boolean:

• False - normalises w.r.t log(# of permutation symbols [`m-1]`) - default

• True - normalises w.r.t log(# of all possible permutations [`m!`])

• Note: Normalised permutation entropy is undefined for `m` = 1.

** Note: When `Typex = 'uniquant'` and `Norm = True`, normalisation is calculated w.r.t. `log(tpx^m)` **

Typex:
• Permutation entropy variation, one of the following:

{`'uniquant'`, `'finegrain'`, `'modified'`, `'ampaware'`, `'weighted'`, `'edge'`, `'phase'`} See the EntropyHub guide for more info on PermEn variants.

tpx:
• Tuning parameter for associated permutation entropy variation.

• [uniquant] ‘tpx’ is the L parameter, an integer > 1 (default = 4).

• [finegrain] ‘tpx’ is the alpha parameter, a positive scalar (default = 1)

• [ampaware] ‘tpx’ is the A parameter, a value in range [0 1] (default = 0.5)

• [edge] ‘tpx’ is the r sensitivity parameter, a scalar > 0 (default = 1)

`XPermEn`, `MSEn`, `XMSEn`, `SampEn`, `ApEn`, `CondEn`

References:
[1] Christoph Bandt and Bernd Pompe,

“Permutation entropy: A natural complexity measure for time series.” Physical Review Letters, 88.17 (2002): 174102.

[2] Xiao-Feng Liu, and Wang Yue,

“Fine-grained permutation entropy as a measure of natural complexity for time series.” Chinese Physics B 18.7 (2009): 2690.

[3] Chunhua Bian, et al.,

“Modified permutation-entropy analysis of heartbeat dynamics.” Physical Review E 85.2 (2012) : 021906

“Weighted-permutation entropy: A complexity measure for time series incorporating amplitude information.” Physical Review E 87.2 (2013): 022911.

[5] Hamed Azami and Javier Escudero,

“Amplitude-aware permutation entropy: Illustration in spike detection and signal segmentation.” Computer methods and programs in biomedicine, 128 (2016): 40-51.

[6] Zhiqiang Huo, et al.,

“Edge Permutation Entropy: An Improved Entropy Measure for Time-Series Analysis,” 45th Annual Conference of the IEEE Industrial Electronics Soc, (2019), 5998-6003

[7] Zhe Chen, et al.

“Improved permutation entropy for measuring complexity of time series under noisy condition.” Complexity 1403829 (2019).

[8] Maik Riedl, Andreas Müller, and Niels Wessel,

“Practical considerations of permutation entropy.” The European Physical Journal Special Topics 222.2 (2013): 249-262.

[9] Kang Huan, Xiaofeng Zhang, and Guangbin Zhang,

“Phase permutation entropy: A complexity measure for nonlinear time series incorporating phase information.” Physica A: Statistical Mechanics and its Applications 568 (2021): 125686.

PhasEn(Sig, K=4, tau=1, Logx=numpy.exp, Norm=True, Plotx=False)

PhasEn estimates the phase entropy of a univariate data sequence.

```Phas = PhasEn(Sig)
```

Returns the phase entropy (`Phas`) estimate of the data sequence (`Sig`) using the default parameters: angular partitions = 4, time delay = 1, logarithm = natural,

```Phas = PhasEn(Sig, keyword = value, ...)
```

Returns the phase entropy (`Phas`) estimate of the data sequence (`Sig`) using the specified ‘keyword’ arguments:

K:
• Angular partitions (coarse graining), an integer > 1

Note: Division of partitions begins along the positive

x-axis. As this point is somewhat arbitrary, it is recommended to use even-numbered (preferably multiples of 4) partitions for sake of symmetry.

tau:
• Time Delay, a positive integer

Logx:
• Logarithm base, a positive scalar

Norm:
• Normalisation of Phas value, a boolean:

• [false] no normalisation

• [true] normalises w.r.t. the # partitions `Log(K)` (Default)

Plotx:
• When `Plotx == true`, returns second-order difference plot (default: false)

`SampEn`, `ApEn`, `GridEn`, `MSEn`, `SlopEn`, `CoSiEn`, `BubbEn`

References:
[1] Ashish Rohila and Ambalika Sharma,

“Phase entropy: a new complexity measure for heart rate variability.” Physiological measurement 40.10 (2019): 105006.

RangEn(Sig, m=2, tau=1, r=0.2, Methodx='SampEn', Logx=numpy.exp)

RangEn estimates the range entropy of a univariate data sequence.

```Rangx, A, B = RangEn(Sig)
```

Returns the range entropy estimate (`Rangx`) and the number of matched state vectors (`m: B`, `m+1: A`) estimated from the data sequence (`Sig`) using the sample entropy algorithm and the following default parameters: embedding dimension = 2, time delay = 1, radius threshold = 0.2, logarithm = natural.

```Rangx, A, B = RangEn(Sig, keyword = value, ...)
```

Returns the range entropy estimates (`Rangx`) for dimensions = `m` estimated for the data sequence (`Sig`) using the specified keyword arguments:

m:
• Embedding Dimension, a positive integer

tau:
• Time Delay, a positive integer

r:
• Radius Distance Threshold, a positive value between 0 and 1

Methodx:
• Base entropy method, either ‘SampEn’ [default] or ‘ApEn’

Logx:
• Logarithm base, a positive scalar

`ApEn`, `SampEn`, `FuzzEn`, `MSEn`

References:
[1] Omidvarnia, Amir, et al.

“Range entropy: A bridge between signal complexity and self-similarity” Entropy 20.12 (2018): 962.

[2] Joshua S Richman and J. Randall Moorman.

“Physiological time-series analysis using approximate entropy and sample entropy.” American Journal of Physiology-Heart and Circulatory Physiology 2000

SampEn(Sig, m=2, tau=1, r=None, Logx=numpy.exp, Vcp=False)

SampEn estimates the sample entropy of a univariate data sequence.

```Samp, A, B = SampEn(Sig)
```

Returns the sample entropy estimates (`Samp`) and the number of matched state vectors (`m: B`, `m+1: A`) for `m` = [0, 1, 2] estimated from the data sequence (`Sig`) using the default parameters: embedding dimension = 2, time delay = 1, radius threshold = 0.2*SD(`Sig`), logarithm = natural.

```Samp, A, B, (Vcp, Ka, Kb) = SampEn(Sig, ..., Vcp = True)
```

If `Vcp == True`, an additional tuple `(Vcp, Ka, Kb)` is returned with the sample entropy estimates (`Samp`) and the number of matched state vectors (`m: B`, `m+1: A`). `(Vcp, Ka, Kb)` contains the variance of the conditional probabilities (`Vcp`), i.e. CP = A/B, and the number of overlapping matching vector pairs of lengths m+1 (`Ka`) and m (`Kb`), respectively. Note `Vcp` is undefined for the zeroth embedding dimension (m = 0) and due to the computational demand, will take substantially more time to return function outputs. See Appendix B in [2] for more info.

```Samp, A, B = SampEn(Sig, keyword = value, ...)
```

Returns the sample entropy estimates (`Samp`) for dimensions = [0, 1, …, `m`] estimated for the data sequence (`Sig`) using the specified keyword arguments:

m:
• Embedding Dimension, a positive integer

tau:
• Time Delay, a positive integer

r:
• Radius Distance Threshold, a positive scalar

Logx:
• Logarithm base, a positive scalar

Vcp:
• Option to return variance of conditional probabilities and the number of overlapping matching vector pairs, a boolean [default: False]

`ApEn`, `FuzzEn`, `PermEn`, `CondEn`, `XSampEn`, `SampEn2D`, `MSEn`

References:
[1] Joshua S Richman and J. Randall Moorman.

“Physiological time-series analysis using approximate entropy and sample entropy.” American Journal of Physiology-Heart and Circulatory Physiology 2000

[2] Douglas E Lake, Joshua S Richman, M.P. Griffin, J. Randall Moorman

“Sample entropy analysis of neonatal heart rate variability.” American Journal of Physiology-Regulatory, Integrative and Comparative Physiology 283, no. 3 (2002): R789-R797.

SlopEn(Sig, m=2, tau=1, Lvls=(5, 45), Logx=2, Norm=True)

SlopEn estimates the slope entropy of a univariate data sequence.

```Slop = SlopEn(Sig)
```

Returns the slope entropy (`Slop`) of the data sequence (`Sig`) for embedding dimensions [2, …, `m`] using the default parameters: embedding dimension = 2, time delay = 1, angular thresholds = [5 45], logarithm = base 2

```[Slop] = SlopEn(Sig, keyword = value, ...)
```

Returns the slope entropy (`Slop`) estimates of the data sequence (`Sig`) using the specified ‘keyword’ arguments:

m:
• Embedding Dimension, an integer > 1

SlopEn returns estimates for each dimension [2,…, `m`]

tau:
• Time Delay, a positive integer

Lvls:
• Angular thresolds, a vector of monotonically increasing values in the range [0 90] degrees.

Logx:
• Logarithm base, a positive scalar (enter 0 for natural log)

Norm:
• Normalisation of `SlopEn` value, one of the following integers:

• [False] no normalisation

• [True] normalises w.r.t. the number of patterns found (default)

`PhasEn`, `GridEn`, `MSEn`, `CoSiEn`, `SampEn`, `ApEn`

References:
[1] David Cuesta-Frau,

“Slope Entropy: A New Time Series Complexity Estimator Based on Both Symbolic Patterns and Amplitude Information.” Entropy 21.12 (2019): 1167.

SpecEn(Sig, N=None, Freqs=(0, 1), Logx=numpy.exp, Norm=True)

SpecEn estimates the spectral entropy of a univariate data sequence.

```Spec, BandEn = SpecEn(Sig)
```

Returns the spectral entropy estimate of the full spectrum (`Spec`) and the within-band entropy (BandEn) estimated from the data sequence (`Sig`) using the default parameters: N-point FFT = 2*len(Sig) + 1, normalised band edge frequencies = [0 1], logarithm = base 2, normalisation = w.r.t # of spectrum/band frequency values.

```Spec, BandEn = SpecEn(Sig, keyword = value, ...)
```

Returns the spectral entropy (`Spec`) and the within-band entropy (`BandEn`) estimate from the data sequence (`Sig`) using the specified ‘keyword’ arguments:

N:
• Resolution of spectrum (N-point FFT), an integer > 1

Freqs:
• Normalised band edge frequencies, a 2 element tuple with values in range [0 1] where 1 corresponds to the Nyquist frequency (Fs/2).

• Note: When no band frequencies are entered, `BandEn == SpecEn`

Logx:
• Logarithm base, a positive scalar (enter 0 for natural log)

Norm:
• Normalisation of Spec value, a boolean:

• [False] no normalisation.

• [True] normalises w.r.t # of spectrum/band frequency values - default.

`XSpecEn`, `MSEn`, `numpy.fftpack`

References:
[1] G.E. Powell and I.C. Percival,

“A spectral entropy method for distinguishing regular and irregular motion of Hamiltonian systems.” Journal of Physics A: Mathematical and General 12.11 (1979): 2053.

[2] Tsuyoshi Inouye, et al.,

“Quantification of EEG irregularity by use of the entropy of the power spectrum.” Electroencephalography and clinical neurophysiology 79.3 (1991): 204-210.

SyDyEn(Sig, m=2, tau=1, c=3, Typex='MEP', Logx=numpy.exp, Norm=True)

SyDyEn estimates the symbolic dynamic entropy of a univariate data sequence.

```SyDy, Zt = SyDyEn(Sig)
```

Returns the symbolic dynamic entropy (`SyDy`) and the symbolic sequence (`Zt`) of the data sequence (`Sig`) using the default parameters: embedding dimension = 2, time delay = 1, symbols = 3, logarithm = natural, symbolic partition type = maximum entropy partitioning (`'MEP'`), normalisation = normalises w.r.t # possible vector permutations (`c^m`)

```SyDy, Zt = SyDyEn(Sig, keyword = value, ...)
```

Returns the symbolic dynamic entropy (`SyDy`) and the symbolic sequence (`Zt`) of the data sequence (`Sig`) using the specified ‘keyword’ arguments:

m:
• Embedding Dimension, a positive integer

tau:
• Time Delay, a positive integer

c:
• Number of symbols, an integer > 1

Typex:
• Type of symbolic sequence partitioning, one of the following:

{`'linear'`, `'uniform'`, `'MEP'` (default), `'kmeans'`} :’Logx: - Logarithm base, a positive scalar :Norm: - Normalisation of SyDyEn value, a boolean:

[False] no normalisation [True] normalises w.r.t # possible dispersion patterns (`c^m+1`) - default

`DispEn`, `PermEn`, `CondEn`, `SampEn`, `MSEn`

References:
[1] Yongbo Li, et al.,

“A fault diagnosis scheme for planetary gearboxes using modified multi-scale symbolic dynamic entropy and mRMR feature selection.” Mechanical Systems and Signal Processing 91 (2017): 295-312.

[2] Jian Wang, et al.,

“Fault feature extraction for multiple electrical faults of aviation electro-mechanical actuator based on symbolic dynamics entropy.” IEEE International Conference on Signal Processing, Communications and Computing (ICSPCC), 2015.

[3] Venkatesh Rajagopalan and Asok Ray,

“Symbolic time series analysis via wavelet-based partitioning.” Signal processing 86.11 (2006): 3309-3320.