0
$\begingroup$

i have imbalanced data consisting of nine classes, and i am planning to collapse them into two classes. i performed stratified (proportionate) sampling between test, validation, and training sets according to the nine classes. Now, when i oversample the training data, should i oversample the nine classes before collapsing them, or should collapse them first and then oversample?

Generally speaking, i believe oversampling then collapsing would be better, but some of the classes in the training data are quite small (5 instances) while others are quite large (1000 instances). Hence, i will be repeat sampling the same 5 instances 1,000, which seems odd. On the other hand, if i collapse then oversample, then there is a good chance the smallest classes may not even end up being resampled.

any advice? thanks!

$\endgroup$
3
  • $\begingroup$ Are you sure you need to oversample at all? What problem do you face for which you believe oversampling to be a solution? $\endgroup$
    – Dave
    Commented Feb 8, 2023 at 16:28
  • $\begingroup$ my understanding is that class imbalances may cause classifiers to be overwhelmed by the large classes and ignore the small ones. in other words, it spend most its time learning the majority class and not minority class. in the end it simply minimizes error by developing a bias toward predicting the majority class $\endgroup$ Commented Feb 8, 2023 at 18:29
  • $\begingroup$ My profile now contains several links to good questions and answers about common misconceptions about class imbalance. While you are correct to think that a model might be inclined to predict majority classes, it is a misconception that this is inherently bad. (This is explained in some of those links.) $\endgroup$
    – Dave
    Commented Feb 8, 2023 at 18:48

1 Answer 1

0
$\begingroup$

firstly welcome to Data Science Stack Exchange. In terms of question as to whether to perform minority oversampling before collapsing the number of classes or after: good question.
By oversampling before, you will ensure that, in the context of the nine classes, that each class is balanced. Then by collapsing them into 2 classes, we might bring about class imbalance again. Therefore, my overall suggestion would be to collapse first into the 2 classes and then perform minority oversampling over the data, such that the class with the fewest number of examples obtains more artificial examples to be equal the number of the majority class.

$\endgroup$
1
  • $\begingroup$ i'm having trouble following your logic. you suggest "to collapse first... and then perform minority oversampling..., such that the class with the fewest number of examples obtains more artificial examples to be equal the number of the majority class." If I collapse first and then oversample, then the smallest class is not guarunteed to have equal size as the majority class. that could only be achieved by oversampling first and then collapsing. Oversampling first causes all 9 classes to have same size before being recoded as two classes. $\endgroup$ Commented Feb 8, 2023 at 16:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.