# Multiclass XGBoost train with num classes = 2

I have a tagged csv file with 5 calsses. I accidentally trained am XGBOOST model with this input but forgot to change the num_classes to 5, but instead it was still 2.

The model I received seems to be a very good one, I have tested it on several data sets. I tried to correct the error and set it to 5, that produced a much worse model.

Does anyone know what is the behavior of the training in such a case? Because I cant really explain why my model is working that good.

Edit: we are using Confusion Metrix to determine how good is the model:

y_pred = randomized_mse.predict(X_test)

print(confusion_matrix(y_test, y_pred))

we set num_class": [2], when in fact we have 5 classes in the data set

• How did you test it ? Namely, how did you test it on 5 classes if it predict on 2 ? – lcrmorin Feb 24 at 12:00
• Could you provide some of your code? This SO question suggests training should break with wrong num_classes: stackoverflow.com/q/36086529/10495893 – Ben Reiniger Feb 24 at 12:50
• @lcrmorin edited post – Amit Raz Feb 24 at 13:27
• It still lack a lot of informations : how the two classes have been selected from the five in your "good" model (not the code you used, but the result what label are in those two classes you got ?). How do you measure performance on your "bad" model ? a 5*5 matrice ? And how do you compare that 5*5 matrice with a 2*2 ? – lcrmorin Feb 24 at 15:18