MCPcopy
hub / github.com/stumpy-dev/stumpy / stump

Function stump

stumpy/stump.py:513–757  ·  view source on GitHub ↗

Compute the z-normalized matrix profile This is a convenience wrapper around the Numba JIT-compiled parallelized ``_stump`` function which computes the (top-k) matrix profile according to STOMPopt with Pearson correlations. Parameters ---------- T_A : numpy.ndarray

(
    T_A,
    m,
    T_B=None,
    ignore_trivial=True,
    normalize=True,
    p=2.0,
    k=1,
    T_A_subseq_isconstant=None,
    T_B_subseq_isconstant=None,
)

Source from the content-addressed store, hash-verified

511 exclude=["normalize", "p", "T_A_subseq_isconstant", "T_B_subseq_isconstant"],
512)
513def stump(
514 T_A,
515 m,
516 T_B=None,
517 ignore_trivial=True,
518 normalize=True,
519 p=2.0,
520 k=1,
521 T_A_subseq_isconstant=None,
522 T_B_subseq_isconstant=None,
523):
524 """
525 Compute the z-normalized matrix profile
526
527 This is a convenience wrapper around the Numba JIT-compiled parallelized
528 ``_stump`` function which computes the (top-k) matrix profile according to
529 STOMPopt with Pearson correlations.
530
531 Parameters
532 ----------
533 T_A : numpy.ndarray
534 The time series or sequence for which to compute the matrix profile.
535
536 m : int
537 Window size.
538
539 T_B : numpy.ndarray, default None
540 The time series or sequence that will be used to annotate ``T_A``. For every
541 subsequence in ``T_A``, its nearest neighbor in ``T_B`` will be recorded.
542 Default is ``None`` which corresponds to a self-join.
543
544 ignore_trivial : bool, default True
545 Set to ``True`` if this is a self-join (i.e., for a single time series
546 ``T_A`` without ``T_B``). This ensures that an exclusion zone is applied
547 to each subsequence in ``T_A`` and all trivial/self-matches are ignored.
548 Otherwise, for an AB-join (i.e., between two times series, ``T_A`` and
549 ``T_B``), set this to ``False``.
550
551 normalize : bool, default True
552 When set to ``True``, this z-normalizes subsequences prior to computing
553 distances. Otherwise, this function gets re-routed to its complementary
554 non-normalized equivalent set in the ``@core.non_normalized`` function
555 decorator.
556
557 p : float, default 2.0
558 The p-norm to apply for computing the Minkowski distance. Minkowski distance is
559 typically used with ``p`` being ``1`` or ``2``, which correspond to the
560 Manhattan distance and the Euclidean distance, respectively. This parameter is
561 ignored when ``normalize == True``.
562
563 k : int, default 1
564 The number of top ``k`` smallest distances used to construct the matrix
565 profile. Note that this will increase the total computational time and memory
566 usage when ``k > 1``. If you have access to a GPU device, then you may be able
567 to leverage ``gpu_stump`` for better performance and scalability.
568
569 T_A_subseq_isconstant : numpy.ndarray or function, default None
570 A boolean array that indicates whether a subsequence in ``T_A`` is constant

Callers 15

test_mparray_initFunction · 0.90
test_mparray_self_joinFunction · 0.90
test_mparray_A_B_joinFunction · 0.90
test_stumpFunction · 0.90
naive_right_mpFunction · 0.90
test_flossFunction · 0.90
test_floss_inf_nanFunction · 0.90
test_stump_int_inputFunction · 0.90

Calls 2

mparrayClass · 0.90
_stumpFunction · 0.85

Tested by 15

test_mparray_initFunction · 0.72
test_mparray_self_joinFunction · 0.72
test_mparray_A_B_joinFunction · 0.72
test_stumpFunction · 0.72
naive_right_mpFunction · 0.72
test_flossFunction · 0.72
test_floss_inf_nanFunction · 0.72
test_stump_int_inputFunction · 0.72