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

Function test_motifs

tests/test_motifs.py:597–623  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

595
596
597def test_motifs():
598 T = np.random.rand(64)
599 m = 3
600
601 max_motifs = 3
602 max_matches = 4
603 max_distance = np.inf
604 cutoff = np.inf
605
606 # naive
607 # `max_distance` and `cutoff` are hard-coded, and set to np.inf.
608 ref_distances, ref_indices = naive_motifs(T, m, max_motifs, max_matches)
609
610 # performant
611 mp = naive.stump(T, m, row_wise=True)
612 comp_distance, comp_indices = motifs(
613 T,
614 mp[:, 0].astype(np.float64),
615 min_neighbors=1,
616 max_distance=max_distance,
617 cutoff=cutoff,
618 max_matches=max_matches,
619 max_motifs=max_motifs,
620 )
621
622 npt.assert_almost_equal(ref_indices, comp_indices)
623 npt.assert_almost_equal(ref_distances, comp_distance)
624
625
626def test_motifs_with_isconstant():

Callers

nothing calls this directly

Calls 2

motifsFunction · 0.90
naive_motifsFunction · 0.85

Tested by

no test coverage detected