I am trying to use the XGBClassifier
wrapper provided by sklearn
for a multiclass problem. My classes are [0, 1, 2], the objective that I use is multi:softmax
. When I am trying to fit the classifier I get
xgboost.core.XGBoostError: value 0for Parameter num_class should be greater equal to 1
If I try to set the num_class parameter the I get the error
got an unexpected keyword argument 'num_class'
Sklearn is setting this parameter automatically so I am not supposed to pass that argument. But why do I get the first error?
In my case, the same error was thrown during a regular fit
call. The root of the issue was that the objective was manually set to multi:softmax
, but there were only 2 classes. Changing it to binary:logistic
solved the problem.