pyhctsa.operations.entropy.rpde

pyhctsa.operations.entropy.rpde(y, m=3, tau=1, epsilon=0.3, t_max=100, returns_per_bin=5, min_returns=50)

Recurrence period density entropy (RPDE).

RPDE (Little et al. 2007) measures how repetitive a signal’s dynamics are, from the distribution of the times at which the delay-embedded trajectory comes back to where it was. The series is embedded as \(v_i = (y_i, y_{i+\tau}, \ldots, y_{i+(m-1)\tau})\). Starting from each embedded point, the trajectory is followed until it has left the ball of radius epsilon (Euclidean) around that point and then re-entered it; the number of steps taken is that point’s recurrence time. The histogram of these times, normalized to unit sum, is the recurrence period density (RPD) \(p_T\). Its Shannon entropy \(H = -\sum_T p_T \ln p_T\) is scaled by \(\ln N_b\), the largest entropy attainable with \(N_b\) bins, to give H_norm in [0, 1]. A periodic signal concentrates the RPD on a few times (H_norm near 0), while a stochastic signal spreads it widely (H_norm near 1).

Recurrence times are counted up to t_max samples, from the first n - t_max embedded points, each of which is followed for t_max steps, so every time from 2 to t_max is equally observable whatever the length of the series (a return takes at least two steps). A period longer than t_max samples is not seen.

The number of bins of the RPD is set by the number of returns counted, \(R\): the times 2 to t_max are grouped into \(N_b = \min(t_{max} - 1, \lceil R / r \rceil)\) bins of equal width, with r = returns_per_bin. A plug-in entropy over more bins than there are returns is limited by \(\ln R\), not by the dynamics, so with a fixed number of bins the outputs of a stochastic series grow with its length as more points return. A series whose points mostly return (periodic or low-dimensional dynamics) reaches the full t_max - 1 bins at a few hundred points and is binned at single-sample resolution from then on. With fewer than min_returns returns the outputs are NaN: there are then too few bins for the entropy to distinguish one RPD from another.

With no limit (t_max = -1, the form in which the method was published) the RPD has one bin per embedded point and is not regrouped: H_norm, propNonZero and maxRPD then change with the length of the series for the same dynamics (maxRPD of a sinusoid is proportional to the length), and long recurrence times are under-counted.

The series is used as given: scale it first (epsilon is an absolute distance, so a z-scored series is intended).

The default radius, epsilon = 0.3, is set by how many points return within t_max steps. A smaller radius resolves finer recurrence structure, but fewer points come back inside it. The figures that follow are for the default embedding (m = 3, tau = 1). For z-scored white noise, about 4000 points are needed for min_returns returns at epsilon = 0.12 (the radius of the published method, which was applied to long, finely sampled recordings), and about 500 at 0.3. The cost of the larger radius is less contrast between dynamics: at 10000 points, H_norm is about 0.12 at epsilon = 0.12 and 0.31 at 0.3 for a sinusoid of period 37 samples, 0.96 and 0.87 for the logistic map at r = 4, and 0.97 and 0.99 for white noise.

Parameters:
y : array-like

Input signal.

m : int, optional

Embedding dimension. Default is 3.

tau : int or str, optional

Embedding time delay: an integer, or a rule understood by get_tau(). Default is 1.

epsilon : float, optional

Recurrence neighborhood radius (Euclidean, in the units of the series). Default is 0.3.

t_max : int, optional

Maximum recurrence time, in samples (at least 3), or -1 for no limit. Default is 100.

returns_per_bin : int, optional

Average number of returns per bin of the RPD (with a limit t_max); 0 keeps one bin per recurrence time. Default is 5.

min_returns : int, optional

Fewest returns for which the outputs are computed (with a limit t_max). Default is 50.

Returns:

H (entropy of the RPD, nats), H_norm (H / ln(Nb), where Nb is the number of bins of the RPD, empty bins included), propNonZero (fraction of bins that are non-empty), meanNonZero (mean non-zero RPD value times Nb) and maxRPD (largest RPD value times Nb, i.e. relative to a uniform RPD). All are NaN if the embedding parameters cannot be determined, the embedding has no more than t_max points (fewer than 4 with no limit), or fewer than min_returns points return (none, with no limit).

Return type:

dict

Notes

Written from the published method: M. A. Little, P. E. McSharry, S. J. Roberts, D. A. E. Costello and I. M. Moroz, “Exploiting nonlinear recurrence and fractal scaling properties for voice disorder detection”, BioMedical Engineering OnLine 6:23 (2007). The close-returns idea goes back to G. B. Mindlin and R. Gilmore, “Topological analysis and synthesis of chaotic time series”, Physica D 58, 229 (1992). The scan is O(n t_max) (O(n^2) in the worst case with no limit) and is compiled with numba.