stumpy icon indicating copy to clipboard operation
stumpy copied to clipboard

Add AB motif discovery

Open mihailescum opened this issue 4 years ago • 1 comments
trafficstars

The motif module that will soon be ready (PR #185) only supports motif discovery for self-joins. Extending this to AB joins should not be difficult.

Open question: Do we need to sample the candidate subsequences from T_A or T_B? I.e. when computing the AB matrix profile, does the matrix profile at index i represent the distance of T_A[i:i+m] to its nearest neighbor in T_B or vice versa?

mihailescum avatar Mar 12 '21 23:03 mihailescum

I.e. when computing the AB matrix profile, does the matrix profile at index i represent the distance of T_A[i:i+m] to its nearest neighbor in T_B

Hopefully, this answers your question. When we do:

stumpy.stump(T_A, m, T_B, ignore_trivial=False)

This returns a matrix profile that has length len(T_A) - m + 1. In other words, we are "annotating" the subsequences from T_A with its nearest neighbor in T_B. So, it may be useful to be consistent with:

def motifs(
    T_A,
    P,
    T_B=None,
    k=1,
    excl_zone=None,
    min_neighbors=1,
    max_occurrences=10,
    atol=None,
    rtol=1.0,
    normalize=True,
):

And then you'd also do:

core.mass(T_A[motif_idx : motif_idx + m], T_B)

Does that help?

seanlaw avatar Mar 13 '21 01:03 seanlaw