How do you do 1-vs-rest classifiers in XGBoost Library (Not Sklearn)?

I am working with a very large dataset that would benefit from using training continuation with the xgb_model parameter in xgb.train(). The label (Y) of dataset itself has 4 classes and is highly imbalanced, so I would like to generate per-label PR curves for it to evaluate its performance, and would thus need to treat each class as it's own binary problem using a one-vs-rest classifier. After a lot of reading I haven't found an equivalent to sklearn's OneVsRestClassifier in the xgboost library. Could anyone provide some guidance on how to implement continuously training one-vs-rest classifiers using the XGBoost library? Thank you in in advance.

Topic xgboost multiclass-classification bigdata machine-learning

Category Data Science


Try to give sklearn wrapper of xgboost to sklearn OneVsRestClassifier.

https://xgboost.readthedocs.io/en/latest/python/python_api.html#module-xgboost.sklearn

If it doesn't work you can create four different label arrays in which samples belong to corresponding class labeled as 1s, and others as 0. Then training with each of the label arrays you can get results for each class.

About

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