0
$\begingroup$

I have a mission of classification with a lot of classes. I am comparing some ML algorithms for this case and I would like to try xgboost. I am writing in python and I am trying to get the best 3 predictions using this algorithm but I couldn't find any method in xgboost API the fits what I want

Any recommendations ?

$\endgroup$
1
$\begingroup$

After fitting the model you can use predict_proba( ) from the docs here

This returns a numpy array with the probability of each data example being of a given class. The three highest probabilities will be your best 3 predictions.

| improve this answer | |
$\endgroup$
0
$\begingroup$

After processing your data , use xgb.fit(X,y) and then xgb.predict_proba(X_test), you will get probabilities of each class for each data point. Next you need to apply probability calibration to get somewhat usable probabilities. Then pick your 3 highest probas, and your data point will most likely have a label of one of those classes.

| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.