My question is rather simple what does the parameter scale_pos_weight in xgboost do? I know typically it should be $\frac{sum(negative cases)}{sum(positive cases)}$.
Does it oversample the minority class by that ratio or does it undersample the majority class by inverse of that ratio? Or something else?
Also I would like to know if during cross validation in xgbcv, does the sampling happen on the test part of the cross-validation also or only the train part is affected by scale_pos_weight? Because i've heard that sampling should never be applied to test as it gives over-optimistic results.
$\begingroup$
$\endgroup$
Add a comment
|
1 Answer
$\begingroup$
$\endgroup$
I guess while computing total error from errors of individual samples, if sample happens to be of a positive class, its error is multiplied by the scale_pos_weight factor. Therefore setting high scale_pos_weight urges optimizer to treat more important (mostly due to its rareness) class with more respect due its higher contribution to the total error value.