I'm trying to apply xgboost and random forest for over and under sampling

For imbalanced data:

train shape -> (199991, 23)

enter image description here

However, reverse my expectation. The accuracy went down for both cases.


  1. Is under and over sampling always not good?
  2. What else should I consider when applying over and under sampling?

1 Answer 1


You are applying xgb and random forest to a multiclassification task and you are doing under sampling to some how try to improve your class

If i understand your histogram, that is the distribution of labels.

When you say accuracy went down for both classes you are refering to a multiclassficitaion problem right?

Answers directly to your questions:

  1. There are same cases when over or undersampling improves your model, but there are not many. Selecting the right loss is more important.

  2. Consider using another can also help you to improve your model.


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.