This question already has an answer here:

I am dealing with a binary response (good/ bad) type data set of size 2153, which reflects a dependent variable. Out of these, only 67 are in favor of "bad" and the remaining are of "good". Also, i have 3 independent variables. How can i model my data set statistically? I tried the logistic regression, but the results are not satisfactory. Does SPSS have any solution for handling such types of imbalanced data?


marked as duplicate by kjetil b halvorsen, whuber Nov 17 '18 at 19:51

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.

  • 6
    $\begingroup$ In what way are the results not satisfactory? Logistic regression sounds on the face of it like an appropriate method to use. There are also binary classification algorithms from supervised machine learning which might be of interest, e.g., support vector machines. $\endgroup$ – tristan Mar 30 '15 at 11:39
  • 2
    $\begingroup$ In what way are the results unsatisfactory? Logistic regression doesn't require balanced data - see here. If finite-sample bias in maximum-likelihood estimates is an issue you could use e.g. Firth's method. $\endgroup$ – Scortchi Mar 30 '15 at 11:45
  • $\begingroup$ thank you for your response. actually, i tried the logistic model for the main data set and it came out with a positive result. after that i again tried the logistic model on one of the variables (binary response) which came out as significant in the main data set. but now, the logistic model is showing inefficient results with large value of odds ratio and insignificant variables, which are the components of the main variable. $\endgroup$ – kuwoli Mar 30 '15 at 12:29
  • $\begingroup$ A commonly used trick is to either "oversample" or "undersample" the dataset, creating an artificial dataset with the same number of positive/negative cases by dropping negative cases or duplicating positive cases. You can use the parameters for prediction, but watch out for variance/significance analysis etc. $\endgroup$ – ciri Mar 30 '15 at 14:43

Most classification algorithms will only perform optimally when the number of samples in each class is roughly the same. One way of addressing the issue of skewed datasets where the minority class is outnumbered by one or more classes is to re-sample the dataset in order to arrive at a more robust and accurate decision boundary. Re-sampling techniques can be divided broadly into four categories: undersampling the majority class, oversampling the minority class, combining over and under sampling, and creating an ensemble of balanced datasets. See Learning from Imbalanced Data by He and Garcia for an extensive review.

Common undersampling strategies include random undersampling (removing points uniformly at random), cluster centroids (compressing majority class by K-means centroids where K is determined based on the level of undersampling), Tomek links (removing overlaps between classes) and others. Common oversampling strategies include random oversampling, SMOTE (generating synthetic examples using KNN), and ADASYN (weighted distribution for minority class examples according to their level of difficulty in learning).

The above methods and more are implemented in the imbalanced-learn library in Python that interfaces with scikit-learn. I recommend trying an combined method such as SMOTE + Tomek links to see if classification accuracy improves on a balanced dataset.


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