How to deal with Class imbalance problem for classification algorithms? Lets say for fraud detection which has two labels for each transaction.


*

*Fraud 

*Non fraud 


In real world scenario we usually get more number of examples of Non fraud data points and very low number of fraud data points. Lets assume the ratio of Non fraud: fraud is 80:20. So my question is even if I build any classifier my model will predict the majority label but I know that data itself is not well distributed. So for such scenarios what should be the approach.
 A: Two approaches I've read about are down-sampling the majority class, and changing the cost of miss-classifying to more severely penalize missing the minority class (fraud, in this case).
A: One option is to down-sample you majority class - i.e. randomly throwing away events belonging to the majority class. That is of course feasible only if you have large enough data to afford this. 
An alternative is to up-sample the minority class; a popular algorithm to generate synthetically data for the minority class is SMOTE (https://www.jair.org/media/953/live-953-2037-jair.pdf). I find a python implementation of it here: https://github.com/scikit-learn-contrib/imbalanced-learn although I was able to use it successfully only when using Support Vector Machines as a classifier. It did not really make a difference with other classifiers.
A: Another option, e.g. used in the R mixOmics package, is the option to base fitness measures during model parameter tuning not only on overall misclassification rate, but also on per-class misclassification rate. This will allow customised tuning and automatic leveraging of classes.
