[skl] Enable cat feature without specifying tree method. (#9353)

This commit is contained in:
Jiaming Yuan
2023-07-03 22:06:17 +08:00
committed by GitHub
parent 39390cc2ee
commit e964654b8f
3 changed files with 5 additions and 7 deletions

View File

@@ -308,7 +308,7 @@ def test_dask_sparse(client: "Client") -> None:
def run_categorical(client: "Client", tree_method: str, X, X_onehot, y) -> None:
parameters = {"tree_method": tree_method, "max_cat_to_onehot": 9999} # force onehot
parameters = {"tree_method": tree_method, "max_cat_to_onehot": 9999} # force onehot
rounds = 10
m = xgb.dask.DaskDMatrix(client, X_onehot, y, enable_categorical=True)
by_etl_results = xgb.dask.train(
@@ -364,9 +364,9 @@ def run_categorical(client: "Client", tree_method: str, X, X_onehot, y) -> None:
check_model_output(reg.get_booster())
reg = xgb.dask.DaskXGBRegressor(
enable_categorical=True, n_estimators=10
enable_categorical=True, n_estimators=10, tree_method="exact"
)
with pytest.raises(ValueError):
with pytest.raises(ValueError, match="categorical data"):
reg.fit(X, y)
# check partition based
reg = xgb.dask.DaskXGBRegressor(