သဘောတရား
Class imbalance and data augmentation
Balance rare classes with resampling, SMOTE, weights and augmentation, and judge with F1 or PR AUC.
ဒီသင်ခန်းစာကို မြန်မာဘာသာ မပြန်ရသေးလို့ အင်္ဂလိပ်လို ပြထားပါတယ်။
Oversampling
- How
- Copies rare examples
- Note
- Can overfit
Undersampling
- How
- Drops common examples
- Note
- Loses data
SMOTE
- How
- New rows between neighbors
- Note
- Numeric features
Class weights
- How
- Rare errors cost more
- Note
- Keeps all data
Synthetic from a model
- How
- A foundation model writes examples
- Note
- Check quality
| Technique | How | Note |
|---|---|---|
| Oversampling | Copies rare examples | Can overfit |
| Undersampling | Drops common examples | Loses data |
| SMOTE | New rows between neighbors | Numeric features |
| Class weights | Rare errors cost more | Keeps all data |
| Synthetic from a model | A foundation model writes examples | Check quality |
1 / 2
Oversampling
- How
- Copies rare examples
- Note
- Can overfit
Undersampling
- How
- Drops common examples
- Note
- Loses data
SMOTE
- How
- New rows between neighbors
- Note
- Numeric features
| Technique | How | Note |
|---|---|---|
| Oversampling | Copies rare examples | Can overfit |
| Undersampling | Drops common examples | Loses data |
| SMOTE | New rows between neighbors | Numeric features |
2 / 2
Class weights
- How
- Rare errors cost more
- Note
- Keeps all data
Synthetic from a model
- How
- A foundation model writes examples
- Note
- Check quality
| Technique | How | Note |
|---|---|---|
| Class weights | Rare errors cost more | Keeps all data |
| Synthetic from a model | A foundation model writes examples | Check quality |
Numeric
- SMOTE, noise
Text
- Back-translation, paraphrase, synonyms
Image
- Flip, crop, rotate, color shift
| Data | Augmentation |
|---|---|
| Numeric | SMOTE, noise |
| Text | Back-translation, paraphrase, synonyms |
| Image | Flip, crop, rotate, color shift |
ဘာလဲ
A dataset is imbalanced when one class is rare, such as fraud in a million payments. A model can reach 99.9 percent accuracy by always saying not fraud. Measure with precision, recall, F1 or the area under the precision-recall curve (PR AUC), not accuracy.
ဘာလဲ
Resampling changes the mix. Oversampling copies rare examples. Undersampling drops common ones, which is fast but throws away data. SMOTE (Synthetic Minority Oversampling Technique) creates new numeric rows between a rare example and its nearest neighbors. Class weights keep the data and make mistakes on the rare class cost more: for example scale_pos_weight in XGBoost. Stratified sampling keeps the class mix in every split. Resample only the training set, after splitting, or copies of one example can land in both train and test.
ဘာလဲ
Augmentation makes new examples from real ones. For text, use back-translation, paraphrase or synonym replacement. For images, use flips, crops, rotations and small color changes, and apply them to training images only. A foundation model can generate synthetic examples of a rare class from a prompt and a few samples. Check them for quality, duplicates and realism, and keep real data in validation and test.
မှတ်ထားရန်
- Use F1, precision, recall or PR AUC. Accuracy hides a rare class.
- Oversample, undersample, or use SMOTE for numeric rows.
- Class weights keep all data and raise the cost of rare-class errors.
- Resample and augment the training set only, after splitting.
- Text: back-translation, paraphrase, synonyms. Images: flip, crop, rotate.
မှတ်ထားရန်
- Synthetic data from a foundation model needs quality checks.
စာမေးပွဲမှာ
- “99 percent accuracy but the model never finds fraud” points to class imbalance: check F1 or PR AUC and rebalance.
- “Create synthetic rows for a rare numeric class” points to SMOTE.
- “Rare class in text data, few examples” points to back-translation or paraphrase augmentation.