# XGBOOST : model.predict_proba() and model.predict() conflicting behaviour

I have two classes : 1 and 2

The output of model.predict_proba() -> [0.333,0.6667]

The output of model.predict() -> 1

This is happening for around 200 test values out of the test data of 10 lac. For all other records, both the functions' output don't conflict. Even if the probability of class 2 is higher, predict function gives final class as 1.

What could be the reason for the output of model.predict() and model.predict_proba() not syncing with each other for those 200 records?

• I think xgboost requires that binary targets (or label in the DMatrix) are 0 or 1 - have you done this? – bradS Jul 25 '19 at 11:48
• @bradS This doesn't make a difference here. However, when i run the model explicitly on one of the records in those 200 records, it gives correct results i.e the class with higher probability value is given by model.predict() . This model is called at production where a lot of requests are passed to it one after the other and in only a few cases (200 out of 10 lakh) this happens. – Manasvi Duggal Jul 25 '19 at 12:11
• Ok. Have you tried to look at those particular 200 observations to see if they have anything in common? E.g. all have a similar value for one feature, have outliers in some features. Also, I'm not sure what you mean by "10 lakh"... is that a number? – bradS Jul 25 '19 at 16:33
• @bradS Yes, the code was run on 10,00,000 records. I couldn't find anything in common for those 200 observations. Is it because too many requests are being sent to predict() that for few 200 observations, it is giving abnormal results or something? – Manasvi Duggal Jul 26 '19 at 7:55