2
votes

I have data set for classification problem. I have in total 50 classes.

 Class1: 10,000 examples 
 Class2: 10 examples
 Class3: 5 examples 
 Class4: 35 examples
 .
 .
 . 
and so on.

I tried to train my classifier using SVM ( both linear and Gaussian kernel). My accurate is very bad on test data 65 and 72% respectively. Now I am thinking to go for a neural network. Do you have any suggestion for any machine learning model and algorithm for large imbalanced data? It would be extremely helpful to me

2

2 Answers

3
votes

You should provide more information about the data set features and the class distribution, this would help others to advice you. In any case, I don't think a neural network fits here as this data set is too small for it.

Assuming 50% or more of the samples are of class 1 then I would first start by looking for a classifier that differentiates between class 1 and non-class 1 samples (binary classification). This classifier should outperform a naive classifier (benchmark) which randomly chooses a classification with a prior corresponding to the training set class distribution. For example, assuming there are 1,000 samples, out of which 700 are of class 1, then the benchmark classifier would classify a new sample as class 1 in a probability of 700/1,000=0.7 (like an unfair coin toss).

Once you found a classifier with good accuracy, the next phase can be classifying the non-class 1 classified samples as one of the other 49 classes, assuming these classes are more balanced then I would start with RF, NB and KNN.

0
votes

From my experience the most successful ways to deal with unbalanced classes are :

  1. Changing distribiution of inputs: 20000 samples (the approximate number of examples which you have) is not a big number so you could change your dataset distribiution simply by using every sample from less frequent classes multiple times. Depending on a number of classes you could set the number of examples from them to e.g. 6000 or 8000 each in your training set. In this case remember to not change distribiution on test and validation set.

  2. Increase the time of training: in case of neural networks, when changing distribiution of your input is impossible I strongly advise you trying to learn network for quite a long time (e.g. 1000 epochs). In this case you have to remember about regularisation. I usually use dropout and l2 weight regulariser with their parameters learnt by random search algorithm.

  3. Reduce the batch size: In neural networks case reducing a batch size might lead to improving performance on less frequent classes.

  4. Change your loss function: using MAPE insted of Crossentropy may also improve accuracy on less frequent classes.

Feel invited to test different combinations of approaches shown by e.g. random search algorithm.