MoonSay /Tutorials/Machine Learning Interview #13
Contents
  1. 01Introduction
  2. 02What goes wrong
  3. 03Balance the data
  4. 04Class weights
  5. 05Fix the scores
  6. 06Interview follow-ups
  7. 07Common misconceptions
  8. 08Interview questions and model answers
  9. 09Summary
  10. References
Imbalanced Data/Chapter 07 of 09

07Common misconceptions

  • “Imbalanced data must always be rebalanced.” Moving the threshold of the plain model often does almost as well (Table 1), because rebalancing and moving the threshold are equivalent for a well-specified model (Elkan, 2001). Try the threshold first.
  • “SMOTE adds new information.” It interpolates between existing frauds. The synthetic points carry no evidence that the original 281 frauds did not, and where frauds sit near legitimate payments they can blur the boundary (He and Garcia, 2009).
  • “Class weights and oversampling are different methods.” A weight w is exactly w copies in the loss (Proposition 1); weights are the cheaper, exact version.
  • “A balanced model’s probabilities are real probabilities.” They describe the balanced training world; their weighted average is one half by (5). Divide the odds by w before using them (Proposition 2).
  • “To undo the balancing, divide the probability by w.” Divide the odds: a balanced 99\% is a real 16\%, not 0.19\%.
  • “The threshold should be 0.5.” Only when both errors cost the same and the probabilities are in the real proportions; otherwise flag when p\ge C_{\mathrm{FP}}/(C_{\mathrm{FP}}+C_{\mathrm{FN}}) (Murphy, 2022, eq. 5.10).
  • “Resample first, then split or cross-validate.” Resampling before the split leaks the validation data into training; our cross-validated average precision went from 0.69 to 0.99.