Find the top non-normalized motifs (i.e., without z-normalization) for time series `T`. A subsequence, `Q`, becomes a candidate motif if there are at least `min_neighbor` number of other subsequence matches in `T` (outside the exclusion zone) with a distance less or equal to `m
(
T,
P,
T_subseq_isfinite,
p,
excl_zone,
min_neighbors,
max_distance,
cutoff,
max_matches,
max_motifs,
atol=1e-8,
)
| 10 | |
| 11 | |
| 12 | def _aamp_motifs( |
| 13 | T, |
| 14 | P, |
| 15 | T_subseq_isfinite, |
| 16 | p, |
| 17 | excl_zone, |
| 18 | min_neighbors, |
| 19 | max_distance, |
| 20 | cutoff, |
| 21 | max_matches, |
| 22 | max_motifs, |
| 23 | atol=1e-8, |
| 24 | ): |
| 25 | """ |
| 26 | Find the top non-normalized motifs (i.e., without z-normalization) for time series |
| 27 | `T`. |
| 28 | |
| 29 | A subsequence, `Q`, becomes a candidate motif if there are at least `min_neighbor` |
| 30 | number of other subsequence matches in `T` (outside the exclusion zone) with a |
| 31 | distance less or equal to `max_distance`. |
| 32 | |
| 33 | Parameters |
| 34 | ---------- |
| 35 | T : numpy.ndarray |
| 36 | The time series or sequence |
| 37 | |
| 38 | P : numpy.ndarray |
| 39 | Matrix Profile of `T` |
| 40 | |
| 41 | T_subseq_isfinite : numpy.ndarray |
| 42 | A boolean array that indicates whether a subsequence in `T` contains a |
| 43 | `np.nan`/`np.inf` value (False) |
| 44 | |
| 45 | p : float |
| 46 | The p-norm to apply for computing the Minkowski distance. Minkowski distance is |
| 47 | typically used with `p` being 1 or 2, which correspond to the Manhattan distance |
| 48 | and the Euclidean distance, respectively. |
| 49 | |
| 50 | excl_zone : int |
| 51 | Size of the exclusion zone |
| 52 | |
| 53 | min_neighbors : int |
| 54 | The minimum number of similar matches a subsequence needs to have in order |
| 55 | to be considered a motif. |
| 56 | |
| 57 | max_distance : float or function |
| 58 | For a candidate motif, `Q`, and a non-trivial subsequence, `S`, `max_distance` |
| 59 | is the maximum distance allowed between `Q` and `S` so that `S` is considered |
| 60 | a match of `Q`. If `max_distance` is a function, then it must be a function |
| 61 | that accepts a single parameter, `D`, in its function signature, which is the |
| 62 | distance profile between `Q` and `T`. |
| 63 | |
| 64 | cutoff : float |
| 65 | The largest matrix profile value (distance) that a candidate motif is allowed |
| 66 | to have. |
| 67 | |
| 68 | max_matches : int |
| 69 | The maximum number of similar matches to be returned. The resulting |
no test coverage detected