A classification dataset has 95% of examples in one class. Which data preparation step helps the model learn the minority class?
- Exam domain
- Data Preparation9% of the exam
- Difficulty
- Medium
- In this mock
- 5 questions on this domainPractise this domain
Why the exam asks this
Data Preparation (9% of the exam).
Objective in the exam guide: Clean and curate data (handle missing, normalize, scale), and analyze class imbalances and feature distributions.
Imbalance is named in the objective.
Why B is the answer
Rebalance with class weights or resampling, and evaluate with per-class metrics
Class weights or resampling raise the minority class's influence, and per-class metrics show whether it is learned.
How it works
With 95% in one class, a model can score 95% accuracy by ignoring the rest.
Class weights or resampling rebalance learning.
Per-class precision and recall show the real effect.
Clues in the question
The words that point to the answer, and what each one tells you.
- 95% in one class
- Imbalance.
In detail
- scikit-learn's compute_class_weight gives balanced weights.
- Analyze feature distributions per class too.
Side by side with look-alikes
| Step | Helps minority class? |
|---|---|
| Weights or resampling, per-class metrics | Yes |
| Delete minority | No |
| Overall accuracy only | No |
| Shuffle twice | No |
Every option, checked
Knowing why each wrong option fails is how you rule it out on exam day.
A. Shuffle the dataset twiceWrong
Shuffling does not change balance.
B. Rebalance with class weights or resampling, and evaluate with per-class metricsRight
Class weights or resampling raise the minority class's influence, and per-class metrics show whether it is learned.
C. Delete the minority classWrong
That removes what you need to predict.
D. Report only overall accuracyWrongMost tempting
Accuracy hides the minority class.
Why it tempts: It looks high. But it hides failure on the minority class.
In practice
- Resample only the training split, never the test split.