| 565 | |
| 566 | |
| 567 | def test_mstump_with_isconstant_case1(): |
| 568 | # case1: `T_subseq_isconstant` is a (partial) function |
| 569 | d = 3 |
| 570 | n = 64 |
| 571 | m = 8 |
| 572 | |
| 573 | T = np.random.uniform(-1000, 1000, size=[d, n]) |
| 574 | T_subseq_isconstant = functools.partial( |
| 575 | naive.isconstant_func_stddev_threshold, quantile_threshold=0.05 |
| 576 | ) |
| 577 | |
| 578 | excl_zone = int(np.ceil(m / 4)) |
| 579 | |
| 580 | ref_P, ref_I = naive.mstump( |
| 581 | T, m, excl_zone, T_subseq_isconstant=T_subseq_isconstant |
| 582 | ) |
| 583 | comp_P, comp_I = mstump(T, m, T_subseq_isconstant=T_subseq_isconstant) |
| 584 | |
| 585 | npt.assert_almost_equal(ref_P, comp_P) |
| 586 | npt.assert_almost_equal(ref_I, comp_I) |
| 587 | |
| 588 | |
| 589 | def test_mstump_with_isconstant_case2(): |