Compute the non-normalized (i.e., without z-normalization) matrix profile This is a convenience wrapper around the Numba JIT-compiled parallelized `_aamp` function which computes the matrix profile according to AAMP. Parameters ---------- T_A : numpy.ndarray The ti
(T_A, m, T_B=None, ignore_trivial=True, p=2.0, k=1)
| 332 | |
| 333 | |
| 334 | def aamp(T_A, m, T_B=None, ignore_trivial=True, p=2.0, k=1): |
| 335 | """ |
| 336 | Compute the non-normalized (i.e., without z-normalization) matrix profile |
| 337 | |
| 338 | This is a convenience wrapper around the Numba JIT-compiled parallelized |
| 339 | `_aamp` function which computes the matrix profile according to AAMP. |
| 340 | |
| 341 | Parameters |
| 342 | ---------- |
| 343 | T_A : numpy.ndarray |
| 344 | The time series or sequence for which to compute the matrix profile |
| 345 | |
| 346 | m : int |
| 347 | Window size |
| 348 | |
| 349 | T_B : numpy.ndarray, default None |
| 350 | The time series or sequence that will be used to annotate T_A. For every |
| 351 | subsequence in T_A, its nearest neighbor in T_B will be recorded. Default is |
| 352 | `None` which corresponds to a self-join. |
| 353 | |
| 354 | ignore_trivial : bool, default True |
| 355 | Set to `True` if this is a self-join. Otherwise, for AB-join, set this |
| 356 | to `False`. Default is `True`. |
| 357 | |
| 358 | p : float, default 2.0 |
| 359 | The p-norm to apply for computing the Minkowski distance. Minkowski distance is |
| 360 | typically used with `p` being 1 or 2, which correspond to the Manhattan distance |
| 361 | and the Euclidean distance, respectively. |
| 362 | |
| 363 | k : int, default 1 |
| 364 | The number of top `k` smallest distances used to construct the matrix profile. |
| 365 | Note that this will increase the total computational time and memory usage |
| 366 | when k > 1. |
| 367 | |
| 368 | Returns |
| 369 | ------- |
| 370 | out : numpy.ndarray |
| 371 | When k = 1 (default), the first column consists of the matrix profile, |
| 372 | the second column consists of the matrix profile indices, the third column |
| 373 | consists of the left matrix profile indices, and the fourth column consists |
| 374 | of the right matrix profile indices. However, when k > 1, the output array |
| 375 | will contain exactly 2 * k + 2 columns. The first k columns (i.e., out[:, :k]) |
| 376 | consists of the top-k matrix profile, the next set of k columns |
| 377 | (i.e., out[:, k:2k]) consists of the corresponding top-k matrix profile |
| 378 | indices, and the last two columns (i.e., out[:, 2k] and out[:, 2k+1] or, |
| 379 | equivalently, out[:, -2] and out[:, -1]) correspond to the top-1 left |
| 380 | matrix profile indices and the top-1 right matrix profile indices, respectively. |
| 381 | |
| 382 | For convenience, the matrix profile (distances) and matrix profile indices can |
| 383 | also be accessed via their corresponding named array attributes, `.P_` and |
| 384 | `.I_`,respectively. Similarly, the corresponding left matrix profile indices |
| 385 | and right matrix profile indices may also be accessed via the `.left_I_` and |
| 386 | `.right_I_` array attributes. |
| 387 | |
| 388 | Notes |
| 389 | ----- |
| 390 | `arXiv:1901.05708 \ |
| 391 | <https://arxiv.org/pdf/1901.05708.pdf>`__ |