How Class Imbalance Treatments Distort SHAP Attribution Fidelity: A Monte Carlo Investigation of Ranking and Magnitude Errors
Through a comprehensive Monte Carlo investigation, this paper demonstrates that while training sample size is the primary driver of SHAP attribution fidelity, common class imbalance treatments often distort feature rankings and magnitudes, leading the authors to recommend avoiding rebalancing in favor of class weighting when SHAP interpretability is a priority.
Original paper licensed under CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer
Imagine you are a detective trying to solve a crime. You have a computer assistant (the machine learning model) that looks at clues (data) to figure out who did it. To trust the computer, you ask it to explain why it pointed to a specific suspect. It gives you a list of reasons, saying, "Clue A was 40% responsible, Clue B was 10%," and so on. This explanation tool is called SHAP.
Now, imagine the crime is very rare. Maybe only 1 out of every 100 cases is a crime, while 99 are innocent people. This is called class imbalance. Because the "crime" examples are so scarce, the computer gets confused. To fix this, data scientists often try to "balance" the training data before teaching the computer. They might:
- Copy-paste the rare crime examples (Random Oversampling).
- Throw away most of the innocent examples (Random Undersampling).
- Invent fake crime examples that look like real ones (SMOTE/ADASYN).
- Tell the computer to pay extra attention to the rare crimes without changing the data (Class Weighting).
The big question this paper asks is: When we fix the data imbalance, do we accidentally break the computer's explanation? Does the list of "most important clues" stay the same? Do the numbers (like "40% responsible") stay accurate?
The author, Rıdvan Kara, ran a massive simulation (like running the same experiment 14,000 times with different settings) to find out. Here is what he discovered, using simple analogies:
1. The Size of the Class Matters More Than the Fix
The most important finding is that how many examples you have matters way more than which balancing trick you use.
- The Analogy: Imagine trying to guess the flavor of a soup. If you only have a tiny spoonful (small sample size), it doesn't matter if you add salt, sugar, or pepper to the spoonful; your guess will be shaky. But if you have a giant pot of soup (large sample size), your guess will be accurate no matter what you did to the ingredients.
- The Result: Increasing the amount of data you feed the computer is the single best way to get a reliable explanation. The choice of balancing method is about 3 to 5 times less important than simply having more data.
2. The "Ranking" vs. The "Magnitude" Trap
The paper makes a crucial distinction between two types of explanations:
- Ranking: "Who is the top suspect?" (Is Clue A more important than Clue B?)
- Magnitude: "How much did Clue A contribute?" (Did it contribute 10% or 50%?)
The study found that some balancing tricks are great at getting the order right but terrible at getting the numbers right.
- The Analogy: Imagine a race.
- Random Oversampling (copy-pasting rare examples) is like a coach who makes sure the runner who should win is in first place (Ranking is good). However, the coach then tells everyone the winner ran twice as fast as they actually did (Magnitude is inflated/wrong).
- Random Undersampling (throwing away data) is like a coach who fires half the team. Now, they can't even tell who the best runner is, and the speed numbers are completely broken. They fail at both ranking and magnitude.
3. The Best "Do-Nothing" and "Soft" Fixes
When looking for the most honest explanation, the paper found two winners that didn't try to force the data to look balanced:
- No Rebalancing: Just use the messy, unbalanced data as it is.
- Class Weighting: Tell the computer, "Hey, the rare crimes are important, so pay extra attention to them," but don't delete or copy any data.
These two methods sat on the "Pareto frontier," meaning they were the best at both getting the order right and keeping the numbers accurate. They are the "minimally invasive" treatments.
4. The Synthetic "Fake" Data Problem
Methods that invent fake data (SMOTE and ADASYN) were okay at getting the order of suspects right, but they messed up the numbers.
- The Analogy: It's like an artist who draws a fake face to fill a gap in a photo. The face looks like a person (the ranking is okay), but if you try to measure the distance between the eyes, the measurement is wrong because the face isn't real.
5. The "Extreme Rarity" Danger Zone
The paper found that these problems get much worse when the crime is extremely rare (less than 5% of cases) and you have very little data.
- The Analogy: If you are trying to find a needle in a haystack, and you only have a tiny piece of hay to look at, any trick you use to "balance" the hay will likely make you miss the needle or guess the needle's size wrong. But if you have a whole barn of hay, you can find the needle easily, and the tricks matter less.
Summary of Recommendations
If you are using AI to explain decisions (like in medical diagnosis or credit scoring) and you have unbalanced data:
- Get more data first. This is the most powerful tool.
- Don't copy-paste or throw away data if you need accurate numbers. These methods distort the "how much" part of the explanation.
- If you must balance, use Class Weighting (telling the model to care more) or just leave the data alone. These keep the explanation honest.
- Check both the order and the numbers. Don't just look at which feature is #1; check if the percentage contribution makes sense, because some methods hide their mistakes in the numbers.
The paper concludes that while balancing data helps the computer predict better, it often breaks the computer's ability to explain itself accurately. If you need a trustworthy explanation, the gentlest approach (Class Weighting) or no approach at all is usually the best bet.
Drowning in papers in your field?
Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.