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

Function test_motifs_with_isconstant

tests/test_motifs.py:626–659  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

624
625
626def test_motifs_with_isconstant():
627 isconstant_custom_func = functools.partial(
628 naive.isconstant_func_stddev_threshold, quantile_threshold=0.05
629 )
630
631 T = np.random.rand(64)
632 m = 3
633
634 max_motifs = 3
635 max_matches = 4
636 max_distance = np.inf
637 cutoff = np.inf
638
639 # naive
640 # `max_distance` and `cutoff` are hard-coded, and set to np.inf.
641 ref_distances, ref_indices = naive_motifs(
642 T, m, max_motifs, max_matches, T_subseq_isconstant=isconstant_custom_func
643 )
644
645 # performant
646 mp = naive.stump(T, m, row_wise=True, T_A_subseq_isconstant=isconstant_custom_func)
647 comp_distance, comp_indices = motifs(
648 T,
649 mp[:, 0].astype(np.float64),
650 min_neighbors=1,
651 max_distance=max_distance,
652 cutoff=cutoff,
653 max_matches=max_matches,
654 max_motifs=max_motifs,
655 T_subseq_isconstant=isconstant_custom_func,
656 )
657
658 npt.assert_almost_equal(ref_distances, comp_distance)
659 npt.assert_almost_equal(ref_indices, comp_indices)
660
661
662def test_motifs_with_max_matches_none():

Callers

nothing calls this directly

Calls 2

motifsFunction · 0.90
naive_motifsFunction · 0.85

Tested by

no test coverage detected