I'm dealing with a supervised binary classification issue. I'd like to use the GBM package to classify individuals as uninfected/infected. I have 15 times more uninfected than infected individuals.

I was wondering if GBM models suffer in the case of imbalanced class sizes? I didn't find any references answering this question.

I tried to adjust the weights by assigning a weight of 1 to the uninfected individuals and a weight of 15 to the infected, but I obtained poor results.

  • 1
    $\begingroup$ (side note) It would be helpful if you provided what GBM stands for and a link to the package. $\endgroup$
    – Memming
    Commented Aug 10, 2015 at 12:58
  • 1
    $\begingroup$ Which loss function are you using for your gradient boosting model? When it comes to imbalanced classes, I've seen poor performance when I've used mean absolute error because it seems to favor the most common class. When I used mean squared error the performance improved substantially $\endgroup$
    – Ryan Zotti
    Commented Aug 12, 2015 at 18:38
  • $\begingroup$ Just for future reference, I find the default loss function used by caret logarithmic loss (cross-deviance) to be pretty helpful as well. ( it penalize heavily on the wrong cases in a negative logarithmic scale) $\endgroup$
    – Lily Long
    Commented Aug 17, 2017 at 5:04
  • $\begingroup$ You can use a modern implementation like xgboost that naively supports imbalanced classification via the scale_pos_weight parameter. For example see this tutorial to get started. $\endgroup$
    – jasonb
    Commented May 15 at 20:44

2 Answers 2


In my experience, GBM does indeed suffer from imbalanced class sizes. I have had good success using SMOTE sampling, which creates synthetic data while oversampling the minority class. You can find it in the DMwR package.


I think your data is similar to Secom data on which I have worked in past and faced lot of difficulties. Following is what I have tried:

  • Different sampling techniques
  • Different classifiers like Random Forest, ANN, GBM, Ensemble methods, etc.

I've also tried 1-Class SVM which has given better results as compared to others like adaboost, Random Forest. You can try that as well.

And I can see you've asked this question 1 year back so if you've found the best way then kindly post it here so that I can get help from it to get better accuracy.


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.