def test_binary_sweep_tree(self): bst0 = BinarySweepTree([1, 2], [{"cost": 1}, {"cost": 8}], None, None) assert_logtol(bst0.sample_at([1, 1.5, 2])["cost"], [1, 3.375, 8], 1e-3) bst0.add_split(1.5, {"cost": 4}) assert_logtol( bst0.sample_at([1, 1.25, 1.5, 1.75, 2])["cost"], [1, 2.144, 4, 5.799, 8], 1e-3)
def test_binary_sweep_tree(self): bst0 = BinarySweepTree([1, 2], [{"cost": 1}, {"cost": 8}], None, None) assert_logtol(bst0.sample_at([1, 1.5, 2])["cost"], [1, 3.375, 8], 1e-3) bst0.add_split(1.5, {"cost": 4}) assert_logtol(bst0.sample_at([1, 1.25, 1.5, 1.75, 2])["cost"], [1, 2.144, 4, 5.799, 8], 1e-3)