Commenting use_label_encoder - xgboost (#1122)

* Commenting use_label_encoder - xgboost

* format change

* moving the import xgboost version to the head

* Shfit params for use_label to outside maxdept

* Keep the original logic

---------

Co-authored-by: Shaokun <shaokunzhang529@gmail.com>
Co-authored-by: Li Jiang <bnujli@gmail.com>
This commit is contained in:
minghao 2023-08-01 09:58:30 +08:00 committed by GitHub
parent 9d857d988b
commit da92238ffe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1508,7 +1508,12 @@ class XGBoostEstimator(SKLearnEstimator):
params["grow_policy"] = params.get("grow_policy", "lossguide")
params["tree_method"] = params.get("tree_method", "hist")
# params["booster"] = params.get("booster", "gbtree")
params["use_label_encoder"] = params.get("use_label_encoder", False)
# use_label_encoder is deprecated in 1.7.
from xgboost import __version__ as xgboost_version
if xgboost_version < "1.7.0":
params["use_label_encoder"] = params.get("use_label_encoder", False)
if "n_jobs" in config:
params["nthread"] = params.pop("n_jobs")
return params