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

Function test_stimp_1_percent_with_isconstant

tests/test_stimp.py:267–341  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

265
266
267def test_stimp_1_percent_with_isconstant():
268 T = np.random.uniform(-1, 1, [64])
269 isconstant_func = functools.partial(
270 naive.isconstant_func_stddev_threshold, stddev_threshold=0.5
271 )
272
273 threshold = 0.2
274 percentage = 0.01
275 min_m = 3
276 n = T.shape[0] - min_m + 1
277
278 seed = np.random.randint(100000)
279
280 np.random.seed(seed)
281 pan = stimp(
282 T,
283 min_m=min_m,
284 max_m=None,
285 step=1,
286 percentage=percentage,
287 pre_scrump=True,
288 # normalize=True,
289 T_subseq_isconstant_func=isconstant_func,
290 )
291
292 for i in range(n):
293 pan.update()
294
295 ref_PAN = np.full((pan.M_.shape[0], T.shape[0]), fill_value=np.inf)
296
297 np.random.seed(seed)
298 for idx, m in enumerate(pan.M_[:n]):
299 zone = int(np.ceil(m / 4))
300 s = zone
301 tmp_P, tmp_I = naive.prescrump(
302 T,
303 m,
304 T,
305 s=s,
306 exclusion_zone=zone,
307 T_A_subseq_isconstant=isconstant_func,
308 T_B_subseq_isconstant=isconstant_func,
309 )
310 ref_P, ref_I, _, _ = naive.scrump(
311 T,
312 m,
313 T,
314 percentage,
315 zone,
316 True,
317 s,
318 T_A_subseq_isconstant=isconstant_func,
319 T_B_subseq_isconstant=isconstant_func,
320 )
321 naive.merge_topk_PI(ref_P, tmp_P, ref_I, tmp_I)
322 ref_PAN[pan._bfs_indices[idx], : ref_P.shape[0]] = ref_P
323
324 # Compare raw pan

Callers

nothing calls this directly

Calls 2

stimpClass · 0.90
updateMethod · 0.45

Tested by

no test coverage detected