0
$\begingroup$

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.

$\endgroup$
1
  • 1
    $\begingroup$ You can continue training in the sklearn API, see stackoverflow.com/q/66794560/10495893. However, it's not clear how to do that to each model inside a OneVsRestClassifier. My guess is you'd just need to do this manually, looping over target classes. $\endgroup$ – Ben Reiniger Apr 20 at 20:27
0
$\begingroup$

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.

$\endgroup$
1
  • $\begingroup$ Thanks, but as I mentioned I specifically need to use the low-level xgboost library (not sklearn) so I can take advantage of training continuation. $\endgroup$ – Sebastian Apr 20 at 18:54

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.