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

Function mmotifs

stumpy/mmotifs.py:22–265  ·  view source on GitHub ↗

Discover the top motifs for the multi-dimensional time series ``T``. Parameters ---------- T : numpy.ndarray The multi-dimensional time series or sequence. P : numpy.ndarray Multi-dimensional Matrix Profile of ``T``. I : numpy.ndarray M

(
    T,
    P,
    I,
    min_neighbors=1,
    max_distance=None,
    cutoffs=None,
    max_matches=10,
    max_motifs=1,
    atol=1e-8,
    k=None,
    include=None,
    normalize=True,
    p=2.0,
    T_subseq_isconstant=None,
)

Source from the content-addressed store, hash-verified

20 ],
21)
22def mmotifs(
23 T,
24 P,
25 I,
26 min_neighbors=1,
27 max_distance=None,
28 cutoffs=None,
29 max_matches=10,
30 max_motifs=1,
31 atol=1e-8,
32 k=None,
33 include=None,
34 normalize=True,
35 p=2.0,
36 T_subseq_isconstant=None,
37):
38 """
39 Discover the top motifs for the multi-dimensional time series ``T``.
40
41 Parameters
42 ----------
43 T : numpy.ndarray
44 The multi-dimensional time series or sequence.
45
46 P : numpy.ndarray
47 Multi-dimensional Matrix Profile of ``T``.
48
49 I : numpy.ndarray
50 Multi-dimensional Matrix Profile indices.
51
52 min_neighbors : int, default 1
53 The minimum number of similar matches a subsequence needs to have in order
54 to be considered a motif. This defaults to ``1``, which means that a
55 subsequence must have at least one similar match in order to be considered a
56 motif.
57
58 max_distance : float, default None
59 Maximal distance that is allowed between a query subsequence
60 (a candidate motif) and all subsequences in ``T`` to be considered as a
61 match. If ``None``, this defaults to
62 ``np.nanmax([np.nanmean(D) - 2 * np.nanstd(D), np.nanmin(D)])``
63 (i.e. at least the closest match will be returned).
64
65 cutoffs : numpy.ndarray or float, default None
66 The largest matrix profile value (distance) for each dimension of the
67 multidimensional matrix profile that a multidimenisonal candidate motif is
68 allowed to have. If ``cutoffs`` is a scalar value, then this value will be
69 applied to every dimension.
70
71 max_matches : int, default 10
72 The maximum number of similar matches (nearest neighbors) to return for each
73 motif. The first match is always the self/trivial-match for each motif.
74
75 max_motifs : int, default 1
76 The maximum number of motifs to return. To consider returning all possible
77 valid motifs, try setting `max_motifs` to the length of your input matrix
78 profile (i.e., ``max_motifs=len(P)``)
79

Calls 2

matchFunction · 0.85
mdlFunction · 0.70