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

Function atsc

stumpy/chains.py:10–72  ·  view source on GitHub ↗

Compute the anchored time series chain (ATSC) 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 : nu

(IL, IR, j)

Source from the content-addressed store, hash-verified

8
9
10def atsc(IL, IR, j):
11 """
12 Compute the anchored time series chain (ATSC)
13
14 Note that since the matrix profile indices, ``IL`` and ``IR``, are pre-computed,
15 this function is agnostic to subsequence normalization.
16
17 Parameters
18 ----------
19 IL : numpy.ndarray
20 Left matrix profile indices.
21
22 IR : numpy.ndarray
23 Right matrix profile indices.
24
25 j : int
26 The index value for which to compute the ATSC.
27
28 Returns
29 -------
30 out : numpy.ndarray
31 Anchored time series chain for index, ``j``
32
33 See Also
34 --------
35 stumpy.allc : Compute the all-chain set (ALLC)
36
37 Notes
38 -----
39 `DOI: 10.1109/ICDM.2017.79 <https://www.cs.ucr.edu/~eamonn/chains_ICDM.pdf>`__
40
41 See Table I
42
43 This is the implementation for the anchored time series chains (ATSC).
44
45 Unlike the original paper, we&#x27;ve replaced the while-loop with a more stable
46 for-loop.
47
48 Examples
49 --------
50 >>> import stumpy
51 >>> import numpy as np
52 >>> mp = stumpy.stump(np.array([584., -11., 23., 79., 1001., 0., -19.]), m=3)
53 >>> stumpy.atsc(mp[:, 2], mp[:, 3], 1)
54 array([1, 3])
55
56 >>> # Alternative example using named attributes
57 >>>
58 >>> mp = stumpy.stump(np.array([584., -11., 23., 79., 1001., 0., -19.]), m=3)
59 >>> stumpy.atsc(mp.left_I_, mp.right_I_, 1)
60 array([1, 3])
61 """
62 C = deque([j])
63 for i in range(IL.size):
64 if IR[j] == -1 or IL[IR[j]] != j:
65 break
66 else:
67 j = IR[j]

Callers 2

test_atscFunction · 0.90
allcFunction · 0.85

Calls

no outgoing calls

Tested by 1

test_atscFunction · 0.72