I have a binary dataset which is 99% in one class and 1% in the other class. I MUST create a logistic regression. I have read literature that says both using this dataset as is, or over/undersampling will do a better job.

Given this conflicting information, does anyone have any experience in this area? Would I be better off first balancing the classes (maybe not to the extent of 50:50), or would it not matter for logistic regression.

There are around 15000 data points - 200 of which belong to the minority class.

  • 1
    $\begingroup$ How much data do you have? $\endgroup$ Commented Oct 19, 2016 at 11:32
  • 2
    $\begingroup$ Logistic regression will work just fine. It doesn't care about the balance. What do you want to do with your analysis? $\endgroup$ Commented Oct 19, 2016 at 11:56
  • $\begingroup$ Just want to build a model for prediction. I thought I ma need to resample my calibration dataset to overcome the unbalance. $\endgroup$
    – Jim
    Commented Oct 19, 2016 at 12:01
  • 2
    $\begingroup$ As a general principle of statistics, any method that requires discarding data to work should be avoided. Logistic regression handles extreme imbalances fine. $\endgroup$ Commented Oct 19, 2016 at 12:21

1 Answer 1


You could simply try both approaches and see if re-balancing helps. Adjusting the cutoff is probably a good idea as well.

It would be better to completely reshuffle your training and test set every time you change something to the algorithm. Also, if you want to have statistically significant comparisons, you need an experimental setup that produces multiple sample points.

On the other hand, logistic regression with its hyperplane separation doesn't have a high risk of overfitting. It can't come up with non-linear separation surfaces. So this rigorous approach is less crucial here than with neural nets for example.


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