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

Function test_stimp_max_m

tests/test_stimp.py:84–135  ·  view source on GitHub ↗
(T)

Source from the content-addressed store, hash-verified

82
83@pytest.mark.parametrize("T", T)
84def test_stimp_max_m(T):
85 threshold = 0.2
86 percentage = 0.01
87 min_m = 3
88 max_m = 5
89 n = T.shape[0] - min_m + 1
90
91 seed = np.random.randint(100000)
92
93 np.random.seed(seed)
94 pan = stimp(
95 T,
96 min_m=min_m,
97 max_m=max_m,
98 step=1,
99 percentage=percentage,
100 pre_scrump=True,
101 # normalize=True,
102 )
103
104 for i in range(n):
105 pan.update()
106
107 ref_PAN = np.full((pan.M_.shape[0], T.shape[0]), fill_value=np.inf)
108
109 np.random.seed(seed)
110 for idx, m in enumerate(pan.M_[:n]):
111 zone = int(np.ceil(m / 4))
112 s = zone
113 tmp_P, tmp_I = naive.prescrump(T, m, T, s=s, exclusion_zone=zone)
114 ref_P, ref_I, _, _ = naive.scrump(T, m, T, percentage, zone, True, s)
115 naive.merge_topk_PI(ref_P, tmp_P, ref_I, tmp_I)
116 ref_PAN[pan._bfs_indices[idx], : ref_P.shape[0]] = ref_P
117
118 # Compare raw pan
119 cmp_PAN = pan._PAN
120
121 naive.replace_inf(ref_PAN)
122 naive.replace_inf(cmp_PAN)
123
124 npt.assert_almost_equal(ref_PAN, cmp_PAN)
125
126 # Compare transformed pan
127 cmp_pan = pan.PAN_
128 ref_pan = naive.transform_pan(
129 pan._PAN, pan._M, threshold, pan._bfs_indices, pan._n_processed
130 )
131
132 naive.replace_inf(ref_pan)
133 naive.replace_inf(cmp_pan)
134
135 npt.assert_almost_equal(ref_pan, cmp_pan)
136
137
138@pytest.mark.parametrize("T", T)

Callers

nothing calls this directly

Calls 2

stimpClass · 0.90
updateMethod · 0.45

Tested by

no test coverage detected