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 lag of the words. The whole series is binarized to symbols
s, and the words of lengthLare(s[t], s[t + tau], ..., s[t + (L-1)*tau])for everyt, as in a time-delay embedding; for ‘diff’ the symbols are the signs of the increments at lag tau,y[t + tau] - y[t]. 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), or one of these computed from the ranks of the series ('ac-rank','ac1e-rank','mi-rank'); seepyhctsa.utils.get_tau(). With the order-based symbols (‘diff’, ‘median’) and a rank-based rule, the result is unchanged by a strictly increasing transformation of the series. Default is 1. NaN is returned if tau cannot be determined, or leaves fewer than two words of length 4.
- Returns:¶
The probability of each binary word of length 1 to 4, keyed by the word in the letters ‘u’ (1) and ‘d’ (0) (‘u’, ‘d’, ‘dd’, ‘du’, …, ‘uuuu’), and the Miller-Madow-corrected entropy of the words of each length (‘h’, ‘hh’, ‘hhh’, ‘hhhh’). NaN if the series is too short for two words of length 4.
- Return type:¶
dict