you need to deal with class imbalance if/because it makes your model better (on unseen data). "Better" is something that you have to define yourself. It could be accuracy, it could be a cost, it could be the true positive rate etc.
There is a subtle nuance that is important to grasp when talking about class imbalance. Namely, is your data imbalanced because:
- the distribution of the data is itself imbalanced
In some cases, one class occurs much more than another. And it's okay. In this case, you have to look at whether certain mistakes are more costly than others. This is the typical example of detecting deadly diseases in patients, figuring out if someone is a terrorist etc. This goes back to the short answer. If some mistakes are more costly than others, you'll want to "punish" them by giving them a higher cost. Therefore, a better model will have a lower cost. If all mistakes are as bad, then there is no real reason why you should use cost sensitive models.
It's also important to note that using cost-sensitive models is not specific to imbalanced datasets. You can use such models if your data is perfectly balanced as well.
- it doesn't represent the true distribution of the data
Sometimes your data is "imbalanced" because it doesn't represent the true distribution of the data. In this case, you have to be careful, because you have "too many" examples of one class and "too few" of the other, and therefore, you need to make sure that your model doesn't over-/underfit on one of these classes.
This is different than using costs because it might not be the case that one mistake is worse than another. What would happen is that you would be biased and it wouldn't be beneficial for your model if the unseen data doesn't have the same distribution as the data you trained on.
Let's say that I give you training data and your goal is to guess if something is red or blue. Whether you mistake blue for red or red for blue doesn't make much of a difference. Your training data has 90% red instances where in real life, they only happen 10% of the time. You would need to deal with that in order to make your model better.