5
$\begingroup$

I have been doing ML for quite some time and I have a thought in class imbalance problems that has bothered me quite a lot.

In problems where we have Imbalanced Dataset (one class is far more frequent than the other class) we have a whole area of using Class Imbalance Techniques to mitigate it. Like resampling, adding class weights in proportion to class size in ML algorithms while training, generating synthetic instances of minority class (SMOTE) etc.

But my problem is we do all that for training data. Real world test data is imbalanced. Shouldn’t be not modify the training data to make it balanced so that it mimics real world data still?

Yeah I know how above techniques help and all. My point is this is biasing the data if real world data is going to see less of minority class. In training we are biasing the data by making algorithm see more of it than what it would see in real life.

What is the right approach here?

$\endgroup$
2
  • $\begingroup$ Does this answer your question? When is unbalanced data really a problem in Machine Learning? Also see the many other pages listed there as linked to that thread. $\endgroup$ – EdM Jul 24 '20 at 17:47
  • 2
    $\begingroup$ not really. What I am looking for is not the tricks to work on Imbalanced Data. But I believe one doesn't need to balance the training data if the reality is imbalanced. As it would bias the training. So more thoughts around those is what I am looking at $\endgroup$ – Baktaawar Jul 24 '20 at 18:28
2
$\begingroup$

In real world, many imbalanced class problems have heavy cost on misclassification. The minority class might be rare, but one occurrence of that class will have really great impact. The minority class is oftentimes "the goal/point" to avoid or to obtain, not "some useless noise class".

This is enough to justify resampling: you'll want the algorithm to be able to not misclassify the minority class. Algorithm that sees imbalanced class data will have less information on whether should it classify an observation as the minority or not. In the end, it will often just label them the majority class.

My point is this is biasing the data if real world data is going to see less of minority class. In training we are biasing the data by making algorithm see more of it than what it would see in real life.

The point of having the algorithm is to use its predictive ability. You will want to have the algorithm predicting correctly, that's it.

Whether or not the algorithm sees the data as it is in real life is not the point. If it is the point, say goodbye to feature engineering as well.


p.s.:

We can stretch this and extrapolate to how humans see imbalanced data. Humans also (kind of) do "resampling/weighting", by remembering more intensely things that are "rare but has great impact", and not the "things that happen everyday and boring". It balances out so the human both remembers "the one thing that happen and changed my life" and "the thing I do everyday, generally".

$\endgroup$
1
  • $\begingroup$ is this true also if we evaluate the model only probabilistically? I mean, if I don't want to put the 0/1 label to the observations, but I want just to sort the records according to the output score, does this problem arise? $\endgroup$ – A1010 Jul 28 '20 at 10:43
1
$\begingroup$

I'm not sure if this is an answer or not, but I'll throw in my two cents.

Real world test data is imbalanced. Shouldn’t be not modify the training data to make it balanced so that it mimics real world data still?

You're referring to the prevalence of classes in the real world. This is an important point to make when you're doing something like risk modelling for medical diagnoses (e.g. your risk of heart attack). If the prevalence of the positive class is low, your risk model should respect that. Resampling for the sake of having a class balance artificially increases baseline risk to 50%.

Classification is something different however. Frank Harrell writes that classification should really only be used when the class is quite obvious and there is low signal to noise (e.g. is this a picture of a dog or not). In that case, prevalence shouldn't really be an issue. You want your algorithm to be able to learn differences between classes, and in my own opinion, their prevalence in the real world is orthogonal to that goal.

So as with everything, the answer depends on what you're doing. If risk of an event occurring is important, and classes are rare, then resampling can turn a perfectly good model bad. However if you just want your computer to distinguish chihuahuas from blueberry muffins, then the prevalence in the real world of either is not important.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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