MCPcopy Index your code
hub / github.com/stumpy-dev/stumpy / allc

Function allc

stumpy/chains.py:75–153  ·  view source on GitHub ↗

Compute the all-chain set (ALLC) Note that since the matrix profile indices, ``IL`` and ``IR``, are pre-computed, this function is agnostic to subsequence normalization. Parameters ---------- IL : numpy.ndarray Left matrix profile indices. IR : numpy.ndarray

(IL, IR)

Source from the content-addressed store, hash-verified

73
74
75def allc(IL, IR):
76 """
77 Compute the all-chain set (ALLC)
78
79 Note that since the matrix profile indices, ``IL`` and ``IR``, are pre-computed,
80 this function is agnostic to subsequence normalization.
81
82 Parameters
83 ----------
84 IL : numpy.ndarray
85 Left matrix profile indices.
86
87 IR : numpy.ndarray
88 Right matrix profile indices.
89
90 Returns
91 -------
92 S : list(numpy.ndarray)
93 All-chain set.
94
95 C : numpy.ndarray
96 Anchored time series chain for the longest chain (also known as the unanchored
97 chain). Note that when there are multiple different chains with length equal to
98 ``len(C)``, then only one chain from this set is returned. You may iterate over
99 the all-chain set, ``S``, to find all other possible chains with length
100 ``len(C)``.
101
102 See Also
103 --------
104 stumpy.atsc : Compute the anchored time series chain (ATSC)
105
106 Notes
107 -----
108 `DOI: 10.1109/ICDM.2017.79 <https://www.cs.ucr.edu/~eamonn/chains_ICDM.pdf>`__
109
110 See Table II
111
112 Unlike the original paper, we&#x27;ve replaced the while-loop with a more stable
113 for-loop.
114
115 This is the implementation for the all-chain set (ALLC) and the unanchored
116 chain is simply the longest one among the all-chain set. Both the
117 all-chain set and unanchored chain are returned.
118
119 The all-chain set, ``S``, is returned as a list of unique numpy arrays.
120
121 Examples
122 --------
123 >>> import stumpy
124 >>> import numpy as np
125 >>> mp = stumpy.stump(np.array([584., -11., 23., 79., 1001., 0., -19.]), m=3)
126 >>> stumpy.allc(mp[:, 2], mp[:, 3])
127 ([array([1, 3]), array([2]), array([0, 4])], array([0, 4]))
128
129 >>> # Alternative example using named attributes
130 >>>
131 >>> mp = stumpy.stump(np.array([584., -11., 23., 79., 1001., 0., -19.]), m=3)
132 >>> stumpy.allc(mp.left_I_, mp.right_I_)

Callers 1

test_allcFunction · 0.90

Calls 2

atscFunction · 0.85
updateMethod · 0.45

Tested by 1

test_allcFunction · 0.72