SOLVED - When using gridsearch, you need to pass the parameter dictionary as XGBClassifier(**param_dict)
Source
Original Post:
I’m receiving the following error when trying to run GridsearchCV
. I’ve found similar questions online, and the solution is normally that the objective function is different in different versions of XGBoost. However, I am passing what appears to be an objective candidate for the version I’m running (1.3.3). I am using 'objective': 'binary:logistic'
as a parameter. I tried removing the objective function altogether to use the default, but still receive this error.
XGBoostError: [08:46:30] /Users/travis/build/dmlc/xgboost/src/objective/objective.cc:26: Unknown objective function: {'n_estimators': 140, 'max_depth': 5, 'learning_rate': 0.1, 'objective': 'binary:logistic', 'min_child_weight': 1, 'gamma': 0, 'subsample': 0.8, 'colsample_bytree': 0.8, 'nthread': 4, 'scale_pos_weight': 1, 'seed': 42}
Objective candidate: survival:aft
Objective candidate: binary:hinge
Objective candidate: multi:softmax
Objective candidate: multi:softprob
Objective candidate: rank:pairwise
Objective candidate: rank:ndcg
Objective candidate: rank:map
Objective candidate: reg:squarederror
Objective candidate: reg:squaredlogerror
Objective candidate: reg:logistic
Objective candidate: reg:pseudohubererror
Objective candidate: binary:logistic
Objective candidate: binary:logitraw
Objective candidate: reg:linear
Objective candidate: count:poisson
Objective candidate: survival:cox
Objective candidate: reg:gamma
Objective candidate: reg:tweedie