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

Function _multi_mass_absolute

stumpy/maamp.py:14–63  ·  view source on GitHub ↗

A multi-dimensional wrapper around "Mueen's Algorithm for Similarity Search" (MASS) absolute to compute multi-dimensional non-normalized (i.e., without z-normalization distance profile. Parameters ---------- Q : numpy.ndarray Query array or subsequence T : nump

(Q, T, m, Q_subseq_isfinite, T_subseq_isfinite, p=2.0)

Source from the content-addressed store, hash-verified

12
13
14def _multi_mass_absolute(Q, T, m, Q_subseq_isfinite, T_subseq_isfinite, p=2.0):
15 """
16 A multi-dimensional wrapper around "Mueen's Algorithm for Similarity Search"
17 (MASS) absolute to compute multi-dimensional non-normalized (i.e., without
18 z-normalization distance profile.
19
20 Parameters
21 ----------
22 Q : numpy.ndarray
23 Query array or subsequence
24
25 T : numpy.ndarray
26 Time series array or sequence
27
28 m : int
29 Window size
30
31 Q_subseq_isfinite : numpy.ndarray
32 A boolean array that indicates whether the subsequence in `Q` contains a
33 `np.nan`/`np.inf` value (False)
34
35 T_subseq_isfinite : numpy.ndarray
36 A boolean array that indicates whether a subsequence in `T` contains a
37 `np.nan`/`np.inf` value (False)
38
39 p : float, default 2.0
40 The p-norm to apply for computing the Minkowski distance. Minkowski distance is
41 typically used with `p` being 1 or 2, which correspond to the Manhattan distance
42 and the Euclidean distance, respectively.
43
44 Returns
45 -------
46 D : numpy.ndarray
47 Multi-dimensional non-normalized (i.e., without z-normalization) distance
48 profile
49 """
50 d, n = T.shape
51 l = n - m + 1
52
53 D = np.empty((d, l), dtype=np.float64)
54
55 for i in range(d):
56 if np.any(~Q_subseq_isfinite[i]):
57 D[i, :] = np.inf
58 else:
59 D[i, :] = core.mass_absolute(Q[i], T[i], p=p)
60
61 D[i][~(T_subseq_isfinite[i])] = np.inf
62
63 return D
64
65
66def maamp_subspace(

Callers 3

test_multi_mass_absoluteFunction · 0.90

Calls

no outgoing calls

Tested by 2

test_multi_mass_absoluteFunction · 0.72