1

I am trying to train an XGBClassifier, but I am getting this error. I am using xgboost version 1.1.0. I used pip install xgboost for installing xgboost, and I also upgraded it.

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

1 Answers1

1

Guessing that you must have used GridSearch Technique to find out the best hyperparameters or even explicitly specifying it, the Correct way to pass the dictionary object param_dict as an argument to XGBoost Classifier Method is -

clf = xgb.XGBClassifier(**param_dict)
Rahul Bordoloi
  • 145
  • 3
  • 9