Disable column sample by node for the exact tree method. (#10083)

This commit is contained in:
Jiaming Yuan
2024-03-01 14:16:10 +08:00
committed by GitHub
parent 8189126d51
commit 3941b31ade
4 changed files with 27 additions and 13 deletions

View File

@@ -35,10 +35,24 @@ class TestTreeMethod:
def test_exact(self, param, num_rounds, dataset):
if dataset.name.endswith("-l1"):
return
param['tree_method'] = 'exact'
param["tree_method"] = "exact"
param = dataset.set_params(param)
result = train_result(param, dataset.get_dmat(), num_rounds)
assert tm.non_increasing(result['train'][dataset.metric])
assert tm.non_increasing(result["train"][dataset.metric])
def test_exact_sample_by_node_error(self) -> None:
X, y, w = tm.make_regression(128, 12, False)
with pytest.raises(ValueError, match="column sample by node"):
xgb.train(
{"tree_method": "exact", "colsample_bynode": 0.999},
xgb.DMatrix(X, y, weight=w),
)
xgb.train(
{"tree_method": "exact", "colsample_bynode": 1.0},
xgb.DMatrix(X, y, weight=w),
num_boost_round=2,
)
@given(
exact_parameter_strategy,