pycrostates.segmentation.entropy#

pycrostates.segmentation.entropy(segmentation, ignore_repetitions=False, log_base=2)[source]#

Compute the Shannon entropy of a symbolic sequence.

Compute the Shannon entropy[1] of the microstate symbolic sequence.

Parameters:
segmentationRawSegmentation | EpochsSegmentation

Segmentation object containing the microstate symbolic sequence.

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.

Returns:
hfloat

The Shannon entropy of the sequence.

References