【问题标题】:XGBoost, XGBClassifier : Unknown Objective Function ErrorXGBoost,XGBClassifier:未知的目标函数错误
【发布时间】:2023-03-15 09:18:01
【问题描述】:

我正在尝试训练 XGBClassifier,但出现此错误。我正在使用 xgboost 1.1.0 版。我使用 pip install xgboost 来安装 xgboost,我也升级了它。

param_dict = {'n_estimators':i, 'max_depth':j, 'objective':'binary:logistic'}

clf = xgb.XGBClassifier(param_dict)
clf.fit(X_tr_1, y_train)


XGBoostError: [08:00:25] C:\Users\Administrator\workspace\xgboost-win64_release_1.1.0\src\objective\objective.cc:26: Unknown objective function: `{'objective': 'binary:logistic', 'eta': 0.02, 'max_depth': 4}`
Objective candidate: survival:aft
Objective candidate: binary:hinge
Objective candidate: multi:softprob
Objective candidate: multi:softmax
Objective candidate: rank:ndcg
Objective candidate: rank:map
Objective candidate: rank:pairwise
Objective candidate: reg:squaredlogerror
Objective candidate: reg:logistic
Objective candidate: binary:logistic
Objective candidate: reg:gamma
Objective candidate: reg:tweedie
Objective candidate: count:poisson
Objective candidate: survival:cox
Objective candidate: binary:logitraw
Objective candidate: reg:linear
Objective candidate: reg:squarederror

【问题讨论】:

  • 你的意思是clf = xgb.XGBClassifier(**param_dict)

标签: python machine-learning xgboost xgbclassifier


【解决方案1】:

猜测您必须使用 GridSearch 技术来找出最佳超参数甚至明确指定它,将字典对象 param_dict 作为参数传递给 XGBoost 分类器方法的正确方法是 -

clf = xgb.XGBClassifier(**param_dict)

【讨论】:

    猜你喜欢
    • 2019-10-07
    • 2021-11-02
    • 1970-01-01
    • 2016-04-13
    • 2019-03-20
    • 2023-02-08
    • 1970-01-01
    • 1970-01-01
    • 2021-03-23
    相关资源
    最近更新 更多