Data Science Asked by Ariel Amar on January 7, 2021
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 ?
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.
Answered by Rylan Steinkey on January 7, 2021
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.
Answered by Blenz on January 7, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP