4
$\begingroup$

The xgboost classifier states the use of parameter scale_pos_weight for 2-class problems.

I have a highly imbalanced dataset with 3 classes. Classes '1' and '-1' are very rare (~1% of dataset) and class '0' is very common.

How do I set this scale_pos_weight parameter in the xgboost classifier correctly for my classification problem?

$\endgroup$
  • $\begingroup$ Are you sure that the best way for handling the imbalanced dataset in your case is setting scale_pos_weight parameter? $\endgroup$ – Alireza Zolanvari Mar 14 '19 at 8:31
1
$\begingroup$

For my multiclass classification problem with similar unbalanced data I used the output from sklearn compute_class_weight function:

https://scikit-learn.org/stable/modules/generated/sklearn.utils.class_weight.compute_class_weight.html

sklearn.utils.class_weight.compute_class_weight(class_weight, classes, y)
$\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.