Classification with imbalanced data I have a dataset that is highly imbalanced. I did some research on Internet, however I did not find what I was looking for. What is the correct sequence for dealing with imbalanced data?
Should we balance the dataset before cleaning the data or not?
Thanks in advance.

I think solving the imbalanced data depends on which part of the data you will focus on in the production environment.

*

*For example, a spam email recognizing task: if the spam email being sent to users is more intolerable, that means we need more data with a "spam" label; or vise versa. (To think about the definitions of precision and recalls.)

*Another example is image recognition: we want to use DL models to predict an image is a cat or a dog. The importance and error tolerance is equal between two labels, which means the balanced data is what we need.

The process to deal with the data:

*

*Find more real-world data (but not computer-generated data). It is the best way to solve the problem.

*If enough data is collected, under-sampling is better.

*Try over-sampling or SMOTE method.

Try the module imbalanced-learn. It will help you much.
