pyhctsa.operations.symbolic.motif_two

pyhctsa.operations.symbolic.motif_two(y, binarize_how='diff', tau=1)

Compute local motifs in a binary symbolization of the input time series.

This function coarse-grains the input time series into a binary sequence using the specified binarization method, and computes the probabilities of binary words of lengths 1 through 4, along with their entropies.

Parameters:
y : array-like

The input time series.

binarize_how : str, optional

The method used for binary transformation. One of:

  • ’diff’: Encode increases in the time series as 1, and decreases or no change as 0.

  • ’mean’: Encode values above the mean as 1, and at or below the mean as 0.

  • ’median’: Encode values above the median as 1, and at or below the median as 0.

Default is 'diff'.

tau : int or str, optional

The time series is first downsampled by this factor (polyphase anti-alias filter, scipy.signal.resample_poly()), so that the words are formed at this lag: an integer, or a rule that sets it from the series: 'ac' (the first zero-crossing of the autocorrelation function), 'ac1e' (the floor of its first 1/e crossing) or 'mi' (the smaller of the first minimum of the Kraskov automutual information and the ‘ac1e’ delay; see pyhctsa.utils.get_tau()). A delay set by a rule is capped at floor(N/50). Default is 1 (no downsampling). NaN is returned if tau cannot be determined.

Returns:

A dictionary containing:

  • ’prob_len_1’, ‘prob_len_2’, …, ‘prob_len_4’:

    Lists of probabilities for each binary word of lengths 1 to 4.

  • ’entropy_len_1’, ‘entropy_len_2’, …, ‘entropy_len_4’:

    Entropy values associated with the word distributions of lengths 1 to 4.

Return type:

dict