This question already has an answer here:

What are the best ways to deal with imbalanced datasets for classifying whether or not individuals pay their tuition? The data is 75% positive class (paid) and 25% negative (unpaid). Some approaches I have read about include stratified k-folds , undersampling and oversampling, and synthetic data with approaches like SMOTE. One challenge I am currently facing is that my XGBoost classifier predicts almost all positives because there is a class imbalance leaning towards the positive class.

Instead of tackling the imbalance by modifying the data, can certain classification algorithms handle imbalanced data better than others?

Lastly, when is data considered imbalanced from a practical standpoint (60-40, 80-20, 95-5, etc.)? Essentially I am asking whether the mild cases of imbalance are still worth addressing, or only severe ones?


marked as duplicate by Sycorax, jbowman, Ferdi, Peter Flom Oct 15 '18 at 11:56

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 2
    $\begingroup$ There are many pages on this site dealing with these questions. This list of top-voted questions and answers is a good place to start. Please look some of those over first, and then edit this question to focus on what you still find confusing. It might be best if you could describe a practical situation that you face, as more specific questions can often get more useful answers. $\endgroup$ – EdM Oct 14 '18 at 17:39
  • $\begingroup$ In what sense do you believe that imbalanced data is a problem? What problem are you trying to solve? $\endgroup$ – Sycorax Oct 14 '18 at 23:45
  • $\begingroup$ It's not that I believe it's a problem, because I think it is representative of the larger data at hand (I am predicting whether individuals pay their fees or not). However, my model is not very predictive, and that's where I think imbalanced data is a problem. The data I have is about 75% positive class (paid) and 25% negative (unpaid), but depending on the fold my model predicts all or nearly all the positive class. $\endgroup$ – Jane Sully Oct 15 '18 at 0:01
  • $\begingroup$ The statement "depending on the fold my model predicts all or nearly all the positive class" makes it sound like you're using accuracy or similar to assess your model. Accuracy is not a good metric to use to evaluate classifier performance. See stats.stackexchange.com/questions/312780/… for more details. $\endgroup$ – Sycorax Oct 15 '18 at 0:34
  • $\begingroup$ Nope, I am using precision, recall, and auc. That comment was based using the confusion matrix for each fold in my kfolds cross validation. $\endgroup$ – Jane Sully Oct 15 '18 at 0:47