| 264 | @pytest.mark.parametrize("T_A, T_B", test_data) |
| 265 | @pytest.mark.parametrize("percentages", percentages) |
| 266 | def test_scrump_self_join_with_isconstant(T_A, T_B, percentages): |
| 267 | isconstant_custom_func = functools.partial( |
| 268 | naive.isconstant_func_stddev_threshold, quantile_threshold=0.05 |
| 269 | ) |
| 270 | |
| 271 | m = 3 |
| 272 | zone = int(np.ceil(m / 4)) |
| 273 | |
| 274 | for percentage in percentages: |
| 275 | seed = np.random.randint(100000) |
| 276 | |
| 277 | np.random.seed(seed) |
| 278 | ref_P, ref_I, ref_left_I, ref_right_I = naive.scrump( |
| 279 | T_B, |
| 280 | m, |
| 281 | T_B, |
| 282 | percentage, |
| 283 | zone, |
| 284 | False, |
| 285 | None, |
| 286 | T_A_subseq_isconstant=isconstant_custom_func, |
| 287 | T_B_subseq_isconstant=isconstant_custom_func, |
| 288 | ) |
| 289 | |
| 290 | np.random.seed(seed) |
| 291 | approx = scrump( |
| 292 | T_B, |
| 293 | m, |
| 294 | ignore_trivial=True, |
| 295 | percentage=percentage, |
| 296 | pre_scrump=False, |
| 297 | T_A_subseq_isconstant=isconstant_custom_func, |
| 298 | ) |
| 299 | approx.update() |
| 300 | comp_P = approx.P_ |
| 301 | comp_I = approx.I_ |
| 302 | comp_left_I = approx.left_I_ |
| 303 | comp_right_I = approx.right_I_ |
| 304 | |
| 305 | naive.replace_inf(ref_P) |
| 306 | naive.replace_inf(comp_P) |
| 307 | npt.assert_almost_equal(ref_P, comp_P) |
| 308 | npt.assert_almost_equal(ref_I, comp_I) |
| 309 | npt.assert_almost_equal(ref_left_I, comp_left_I) |
| 310 | npt.assert_almost_equal(ref_right_I, comp_right_I) |
| 311 | |
| 312 | |
| 313 | @pytest.mark.parametrize("T_A, T_B", test_data) |