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

Function aamp_match

stumpy/aamp_motifs.py:315–411  ·  view source on GitHub ↗

Find all matches of a query `Q` in a time series `T`, i.e. the indices of subsequences whose distances to `Q` are less or equal to `max_distance`, sorted by distance (lowest to highest). Around each occurrence an exclusion zone is applied before searching for the next. Paramet

(
    Q,
    T,
    T_subseq_isfinite=None,
    max_distance=None,
    max_matches=None,
    atol=1e-8,
    query_idx=None,
    p=2.0,
)

Source from the content-addressed store, hash-verified

313
314
315def aamp_match(
316 Q,
317 T,
318 T_subseq_isfinite=None,
319 max_distance=None,
320 max_matches=None,
321 atol=1e-8,
322 query_idx=None,
323 p=2.0,
324):
325 """
326 Find all matches of a query `Q` in a time series `T`, i.e. the indices
327 of subsequences whose distances to `Q` are less or equal to
328 `max_distance`, sorted by distance (lowest to highest).
329
330 Around each occurrence an exclusion zone is applied before searching for the next.
331
332 Parameters
333 ----------
334 Q : numpy.ndarray
335 The query sequence. It doesn't have to be a subsequence of `T`
336
337 T : numpy.ndarray
338 The time series of interest
339
340 T_subseq_isfinite : numpy.ndarray, default None
341 A boolean array that indicates whether a subsequence in `T` contains a
342 `np.nan`/`np.inf` value (False)
343
344 max_distance : float or function, default None
345 Maximum distance between `Q` and a subsequence `S` for `S` to be considered a
346 match. If a function, then it has to be a function of one argument `D`, which
347 will be the distance profile of `Q` with `T` (a 1D numpy array of size `n-m+1`).
348 If None, defaults to
349 `np.nanmax([np.nanmean(D) - 2 * np.nanstd(D), np.nanmin(D)])` (i.e. at
350 least the closest match will be returned).
351
352 max_matches : int, default None
353 The maximum amount of similar occurrences to be returned. The resulting
354 occurrences are sorted by distance, so a value of `10` means that the
355 indices of the most similar `10` subsequences is returned. If `None`, then all
356 occurrences are returned.
357
358 atol : float, default 1e-8
359 The absolute tolerance parameter. This value will be added to `max_distance`
360 when comparing distances between subsequences.
361
362 query_idx : int, default None
363 This is the index position along the time series, `T`, where the query
364 subsequence, `Q`, is located.
365 `query_idx` should only be used when the matrix profile is a self-join and
366 should be set to `None` for matrix profiles computed from AB-joins.
367 If `query_idx` is set to a specific integer value, then this will help ensure
368 that the self-match will be returned first.
369
370 p : float, default 2.0
371 The p-norm to apply for computing the Minkowski distance. Minkowski distance is
372 typically used with `p` being 1 or 2, which correspond to the Manhattan distance

Callers 5

test_matchFunction · 0.90
test_aamp_matchFunction · 0.90
_aamp_motifsFunction · 0.85
aamp_mmotifsFunction · 0.85

Calls

no outgoing calls

Tested by 3

test_matchFunction · 0.72
test_aamp_matchFunction · 0.72