Weka Tutorial 04: Systematic Oversampling (Class Imbalance Problem)

Rushdi Shams · 94K views · 2012 · 12:43

Open on YouTube

Machine learning & deep learningData science & statisticstutorial

Why Stack Overflow recommends it

Stack Overflow users link it when answering questions about imbalanced datasets in Weka, as a quick GUI walkthrough of applying SMOTE before training a classifier.

Recommended by 1 people across 1 different months, 2013 to 2014.

What it is

A short screencast tutorial from Rushdi Shams showing how to fix class imbalance in Weka by oversampling the minority class using the GUI. It walks through the SMOTE-style oversampling filter step by step.

What people said

Recommends metrix · 2013-07 · Stack Overflow · on “How to deal with frequent classes?”

You need to "SMOTE" your data. First figure out how many more instances of the minority case you need. In my case I wanted to get around a 50/50 ratio so I needed to over sample by 1300 percent. This tutorial will help if you are using the GUI: [this video] If you are doing this from the command line using Weka, the following command will get you going: #Weka 3.7.7 java weka.Run -no-scan weka.filters.supervised.instance.SMOTE \ -c last -K 25 -P 1300.0 -S 1 -i input.arff -o output.arff The -K option is the number of neighbors to take into account when smoting the data. The default is 5, but 25 worked best for my dataset.

Cites Walter · 2013-09 · Stack Overflow · on “Weka predicting same class”

It is possible that your J48 decision tree is a single node that simply says each instance belongs to the class "theme". If you do this procedure with the Weka gui, you can right click the entry in the result buffer and select "Visualize Tree". If you find that the tree is indeed a single node it may be this way because you are possibly working with an imbalanced dataset. For imbalanced datasets the J48 pruning procedures would likely find benefit from removing branches leading to minority classes and simply predict everything as what I guess to be the majority class "theme". This is a common problem with imbalanced datasets. You may try using SMOTE as a preprocessing procedure ( here [VIDEO

Cites Ignacio Gómez · 2014-12 · Stack Overflow · on “Resample Filter of WEKA - How to interpret the result”

Try with the SMOTE [this video] filter on the preprocess. It balance your dataset by generating new data for the minor class.