pycrostates.segmentation.excess_entropy_rate#

pycrostates.segmentation.excess_entropy_rate(segmentation, history_length, ignore_repetitions=False, log_base=2, n_jobs=1)[source]#

Estimate the entropy rate and the excess_entropy of the segmentation.

The entropy rate and the excess_entropy are estimated from a linear fit:

\[H(X_{n}^{(k)}) = a \cdot k + b\]

where a is the entropy rate and b the excess entropy as described in Von Wegner[1].

Parameters:
segmentationRawSegmentation | EpochsSegmentation

Segmentation object containing the microstate symbolic sequence.

history_lengthint

Maximum history length in sample to estimate the excess entropy rate.

ignore_repetitionsbool

If True, ignores state repetitions. For example, the input sequence AAABBCCD will be transformed into ABCD before any calculation. This is equivalent to setting the duration of all states to 1 sample.

log_basefloat | str

The log base to use. If string: * bits: log_base = 2 * natural: log_base = np.e * dits: log_base = 10 Default to bits.

n_jobsint | None

The number of jobs to run in parallel. If -1, it is set to the number of CPU cores. Requires the joblib package. None (default) is a marker for ‘unset’ that will be interpreted as n_jobs=1 (sequential execution) unless the call is performed under a joblib.parallel_config context manager that sets another value for n_jobs.

Returns:
afloat

Entropy rate (slope).

bfloat

Excess entropy (intercept).

residualfloat

Sum of squared residuals of the least squares fit.

lagsarray of shape (history_length,)

Lag values in sample used for the fit.

joint_entropiesarray of shape (history_length,)

Joint entropy value for each lag.

References

Examples using pycrostates.segmentation.excess_entropy_rate#

Entropy and related measures

Entropy and related measures