0
$\begingroup$

A data is imbalanced if a target class proportions are unequal and typically, heavily biased. But, what is the exact measurement of this heavy bias?

Before applying imbalance techniques (SMOTE, ADASYN, Tree classifiers, etc.), I want to auto detect if problem belongs to imbalance class problem.

$\endgroup$
2

1 Answer 1

1
$\begingroup$

Depending on your dataset, I would say you can set the threshold yourself.

For example, a 50% split is a perfect balance so by definition any deviation away would be an imbalanced problem. That being said, this is quite typical, so it would make more sense to set your threshold to be somewhere around 80% imbalance or higher.

Count your classes and set a threshold, e.g.

threshold = 80
imbalance_measure = (minority_class/majority_class)*100
if imbalance_measure >= threshold:
    print("Imbalanced problem")
else:
    print("Balanced problem")

In fact, if you data is suitable you can test this yourself through cross-validation

Some further relevant documents here

$\endgroup$
2
  • $\begingroup$ Any standard way to generalize for multi class problem say 10 classes ? $\endgroup$
    – Kaustuv
    Commented Feb 23, 2021 at 10:15
  • $\begingroup$ Not that I know of. If you have your data in a pandas dataframe you could do something like df.groupby(['class']).count() / len(df['class']) $\endgroup$
    – WBM
    Commented Feb 23, 2021 at 10:29

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.