| 134 | @pytest.mark.parametrize("T_A, T_B", test_data) |
| 135 | @pytest.mark.parametrize("percentages", percentages) |
| 136 | def test_scrump_self_join(T_A, T_B, percentages): |
| 137 | m = 3 |
| 138 | zone = int(np.ceil(m / 4)) |
| 139 | |
| 140 | for percentage in percentages: |
| 141 | seed = np.random.randint(100000) |
| 142 | |
| 143 | np.random.seed(seed) |
| 144 | ref_P, ref_I, ref_left_I, ref_right_I = naive.scrump( |
| 145 | T_B, m, T_B, percentage, zone, False, None |
| 146 | ) |
| 147 | |
| 148 | np.random.seed(seed) |
| 149 | approx = scrump( |
| 150 | T_B, m, ignore_trivial=True, percentage=percentage, pre_scrump=False |
| 151 | ) |
| 152 | approx.update() |
| 153 | comp_P = approx.P_ |
| 154 | comp_I = approx.I_ |
| 155 | comp_left_I = approx.left_I_ |
| 156 | comp_right_I = approx.right_I_ |
| 157 | |
| 158 | naive.replace_inf(ref_P) |
| 159 | naive.replace_inf(comp_P) |
| 160 | npt.assert_almost_equal(ref_P, comp_P) |
| 161 | npt.assert_almost_equal(ref_I, comp_I) |
| 162 | npt.assert_almost_equal(ref_left_I, comp_left_I) |
| 163 | npt.assert_almost_equal(ref_right_I, comp_right_I) |
| 164 | |
| 165 | |
| 166 | @pytest.mark.parametrize("T_A, T_B", test_data) |