How to predict only those values that our model is 95% sure of?

I have 5 classes. I made a XGBoost Classification model and used model.predict(test) to predict the classes of test dataset. Out of all those values predicted by my model, I would like to know only those values that my model is more than 95% sure that the predicted value is correct. I mean, I would only like those predictions that my model is very confident of predicting. How do I find those predictions?

Topic confidence machine-learning

Category Data Science


Have a look at the predict_proba method of the XGBClassifier class which will give you the probabilities for each class instead of just the predicted class. You can then use these probabilities to only select the class with the highest probability if the probability is above the treshold you want to set (in this case 0.95).

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.