2
$\begingroup$

I have a data set where I need to detect fraud. 99% are not fraud and 1% are.

What methods can be used to solve problems where classes are imbalanced?

$\endgroup$
1
  • 3
    $\begingroup$ There are a ton of methods and giving a review here would not make sense since you can find review articles easily by googling. If you are working in python I suggest you look at this package. contrib.scikit-learn.org/imbalanced-learn/stable $\endgroup$
    – Keith
    Commented Nov 20, 2017 at 5:56

4 Answers 4

2
$\begingroup$

There are 2 Techniques:

  1. Oversampling: There are many techniques under this, ROSE and SMOTE are the most famous techniques used for oversampling. In ROSE it just increases the minority classes. In SMOTE it synthetically generates more number of rare minority classes for balancing. Most of the Scenarios SMOTE gives better results than ROSE but you should try both. Other than that there is just another techniques which just duplicates the records to the make it equal n number. This Link, is for implemenation of SMOTE in Python.

  2. UnderSampling: There are many techniques under this too, but this Link-1, Link-2 gives you better idea about undersampling. Generally I don't prefer Undersampling, as you would loose some infomation.

The reason why you need to use these techniques are, if we don't use then the model accuracy will be very high it will be able to predict with 99% accuracy correctly the cases which are not fraud, which we don't want. if it can predict with same accuracy to find out fraud, then that is a great insight. This can be achived only by using either of the above techniques.

Do have a look and Let me know if you have any additional questions.

$\endgroup$
1
$\begingroup$

There are several techniques

Random up-sampling

  • Disadvantage->create duplicated and/or artificial instances which may introduce bias and /or noise to the original data

Random Down-Sampling

  • Disadvantage -> not all data points are used. Potentially removing useful information. Better choice for data with very high class imbalance.

Repeated Sampling

  • in this process, you identify few definite negatives from your data, along with definite positives.Train your model and classify all your sample data based upon this model.
  • Repeat this process, and perform voting at the end to get the class labels for highly imbalanced datasets.
$\endgroup$
1
$\begingroup$

You can use some related parameters as cost function such as Kappa, CEN, and MCEN in all types of algorithms.

Disclaimer:

If you are using Python you can use PyCM module. This module after receiving the confusion matrix of your data can suggest some parameters which is suitable for evaluating your algorithm according to the characteristics of your dataset.

Here is a simple code to get the recommended parameters from this module:

>>> from pycm import *

>>> cm = ConfusionMatrix(matrix={"Class1": {"Class1": 1, "Class2":2}, "Class2": {"Class1": 0, "Class2": 5}})  

>>> print(cm.recommended_list)
["Kappa", "SOA1(Landis & Koch)", "SOA2(Fleiss)", "SOA3(Altman)", "SOA4(Cicchetti)", "CEN", "MCEN", "MCC", "J", "Overall J", "Overall MCC", "Overall CEN", "Overall MCEN", "AUC", "AUCI", "G", "DP", "DPI", "GI"]
$\endgroup$
0
$\begingroup$

You can do following the two approaches.

  1. As others mentioned already, you can change the distribution to 50-50 in the training dataset.
  2. You can use weighted random forest algorithm for creating a balance between the two classes. In this algorithm, Random Forest itself adds weight to the two classes in order to achieve 50-50 percent weight.
$\endgroup$
1
  • 1
    $\begingroup$ rf's are sensitive to the imbalancedness.. go for boosting models.. $\endgroup$
    – Aditya
    Commented May 12, 2018 at 18:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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