I am using XGBClassifier (in xgboost) for a multi-class classification. Upon executing the classifier, I am receiving an error stating:
unexpected keyword a
In the Sklearn XGB API you do not need to specify the num_class parameter explicitly. In case the target has more than 2 levels, XGBClassifier automatically switches to multiclass classification mode.
evals_result = {}
self.classes_ = list(np.unique(y))
self.n_classes_ = len(self.classes_)
if self.n_classes_ > 2:
# Switch to using a multiclass objective in the underlying XGB instance
xgb_options["objective"] = "multi:softprob"
xgb_options['num_class'] = self.n_classes_
Check the complete source code here: https://github.com/dmlc/xgboost/blob/master/python-package/xgboost/sklearn.py