5
$\begingroup$

This question already has an answer here:

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.

$\endgroup$

marked as duplicate by kjetil b halvorsen, Peter Flom Nov 3 '16 at 12:09

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.

  • 1
    $\begingroup$ How much data do you have? $\endgroup$ – gung Oct 19 '16 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$ – prince_of_pears Oct 19 '16 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 Oct 19 '16 at 12:01
  • 1
    $\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$ – Frank Harrell Oct 19 '16 at 12:21
0
$\begingroup$

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.

$\endgroup$

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