[skl] Enable cat feature without specifying tree method. (#9353)
This commit is contained in:
@@ -1390,7 +1390,6 @@ def test_categorical():
|
||||
X, y = tm.make_categorical(n_samples=32, n_features=2, n_categories=3, onehot=False)
|
||||
ft = ["c"] * X.shape[1]
|
||||
reg = xgb.XGBRegressor(
|
||||
tree_method="hist",
|
||||
feature_types=ft,
|
||||
max_cat_to_onehot=1,
|
||||
enable_categorical=True,
|
||||
@@ -1409,7 +1408,7 @@ def test_categorical():
|
||||
onehot, y = tm.make_categorical(
|
||||
n_samples=32, n_features=2, n_categories=3, onehot=True
|
||||
)
|
||||
reg = xgb.XGBRegressor(tree_method="hist")
|
||||
reg = xgb.XGBRegressor()
|
||||
reg.fit(onehot, y, eval_set=[(onehot, y)])
|
||||
from_enc = reg.evals_result()["validation_0"]["rmse"]
|
||||
predt_enc = reg.predict(onehot)
|
||||
|
||||
Reference in New Issue
Block a user