# How to deal with classification problem where labels are non uniformly distributed?

I have a data set which has around 1000 samples and are divided in 4 groups - A, B ,C , D. The problem I am facing is that there are very high number of data sample which have B and C s output. They outweigh other two by factor of 3:1. Due to this most of the classification problems are producing very inefficient results with results from other two classes being mapped to A and B quite often . Is there any way to deal with it?

Welcome to DataScience.SE! You need to ensure that your training distribution is similar to your test distribution in order to get the best results. This can be done through stratified sampling. It might be that there is no problem, and that the classifier is simply allocating its resources to best classify the majority case, though I'm a bit confused by your description because you say that B and C dominate and the "other two classes" (A and D) are "mapped to A and B quite often". One option is to use more discriminating features, if you can think of any. Another is to partition the large classes into (B becomes the union of $B_i$ and likewise for C) if applicable. This can help if the shape of the class is complex by breaking it up into learnable pieces. It helps to plot your inputs, colored by class, to understand which classes overlap or have complex shapes. Finally, you can modify your loss function if getting certain classes wrong is more important than others.
• Because you want your training set to be representative of your test set, assuming your test set is also representative of data you expect to process. We seek the parameter $\arg \min_w \mathbb E_\theta f(X,Y; w)$ under distribution $\theta$ by minimizing $\frac{1}{N} \sum_i f(x_i,y_i; w) + \lambda r(w)$. The approximation only holds if the samples are from $\theta$, no? – Emre Sep 13 '16 at 16:17