# How to tackle datasets where the dependent variables has around 80% 1's? [duplicate]

If my target variable has more 1's (say around 80%) than 0's then how do I handle such imbalanced data for building models using different methods such as GBM, RF, logistic regression, etc. Should I perform under sampling of 1's?

80% is not that bad. Don't try over- or undersampling unless you have a really good reason and know what you are doing. It is an intuitive trick maybe, but not really a valid or theoretical one, and can easily backfire. Maybe read this: http://www.fharrell.com/2017/01/classification-vs-prediction.html.

It depends on what your data is about. But if it is something like measuring the number of people arrested for drunk driving or whether a person attended a sports event last Saturday, then you should be looking at Zero-Inflated models. This type of data set is going to have a lot of observations that have or have not done the event that is under observation.

In the general population, most people don't drink and drive, so you will have a lot of 0's in that data set.

For the second set above, if you are in a college town during football season, then you should end up with a lot of "Yes" responses, which you can easily code as a 0.

If you are using R, then Extending the Linear Model with R by Faraway (2016) has a section on this. Otherwise, google for "Zero-inflated models" and see what you find.

I've just learned about this type of model, so anyone more seasoned feel free to critique away.

• Let's say you are counting drunk people on weekdays, and you model this with a Poisson regression, you will indeed find many zeros. The zero inflation really only happens if there are more zeros than a Poisson process already accounts for. Your observation, that many people don't drink and drive, is already accounted for with a Poisson distribution, zeros do always occur depending onthe rate. The increase in the zeros happens, because on normal weekdays everyone doesn't drink. In weekends, lots of people drink. This is not so much a case of zero-inflation, but more a case of overdispersion.
– Gijs
Oct 14, 2017 at 9:10
• But the OP is not talking about Poisson, but about a Bernoulli (0-1) distribution. In such a case, zero-inflation actually doesn't make sense. Have a look at stats.stackexchange.com/questions/279273/…, or the great example by McElreath in youtube.com/watch?v=rTrCA3yuabI.
– Gijs
Oct 14, 2017 at 9:14