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

Function test_stumpi_identical_subsequence_self_join

tests/test_stumpi.py:688–734  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

686
687
688def test_stumpi_identical_subsequence_self_join():
689 m = 3
690 zone = int(np.ceil(m / 4))
691
692 seed = np.random.randint(100000)
693 np.random.seed(seed)
694
695 identical = np.random.rand(8)
696 T = np.random.rand(20)
697 T[1 : 1 + identical.shape[0]] = identical
698 T[11 : 11 + identical.shape[0]] = identical
699 stream = stumpi(T, m, egress=False)
700 for i in range(34):
701 t = np.random.rand()
702 stream.update(t)
703
704 comp_P = stream.P_
705 # comp_I = stream.I_
706
707 ref_mp = naive.stump(stream.T_, m, exclusion_zone=zone, row_wise=True)
708 ref_P = ref_mp[:, 0]
709 # ref_I = ref_mp[:, 1]
710
711 naive.replace_inf(ref_P)
712 naive.replace_inf(comp_P)
713
714 npt.assert_almost_equal(ref_P, comp_P, decimal=config.STUMPY_TEST_PRECISION)
715 # npt.assert_almost_equal(ref_I, comp_I)
716
717 np.random.seed(seed)
718 identical = np.random.rand(8)
719 T = np.random.rand(20)
720 T[1 : 1 + identical.shape[0]] = identical
721 T[11 : 11 + identical.shape[0]] = identical
722 T = pd.Series(T)
723 stream = stumpi(T, m, egress=False)
724 for i in range(34):
725 t = np.random.rand()
726 stream.update(t)
727
728 comp_P = stream.P_
729 # comp_I = stream.I_
730
731 naive.replace_inf(comp_P)
732
733 npt.assert_almost_equal(ref_P, comp_P, decimal=config.STUMPY_TEST_PRECISION)
734 # npt.assert_almost_equal(ref_I, comp_I)
735
736
737def test_stumpi_identical_subsequence_self_join_egress():

Callers

nothing calls this directly

Calls 2

stumpiClass · 0.90
updateMethod · 0.45

Tested by

no test coverage detected