MLA-C01 Data Preparation for Machine Learning Practice Question
A data scientist is training a binary classifier on a highly imbalanced dataset (1:100 class ratio). The dataset contains 500,000 rows and 30 features. The data is stored in S3 in Parquet format. The data scientist wants to use SageMaker's built-in XGBoost algorithm. Which data preparation technique should the data scientist apply to best address the class imbalance without causing data leakage?
⚠ Common exam trap
AWS often tests the misconception that resampling techniques (like SMOTE or random oversampling) are always safe, when in fact applying them before splitting introduces data leakage, whereas built-in parameters like scale_pos_weight avoid this pitfall.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
Use the scale_pos_weight parameter in XGBoost to assign higher weight to the minority class.
The scale_pos_weight parameter in XGBoost directly adjusts the loss function to penalize misclassifications of the minority class more heavily, effectively handling class imbalance without modifying the dataset. This avoids data leakage because the weighting is applied during training only, not during preprocessing, and does not involve any synthetic data generation or resampling that could inadvertently expose test information.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Undersample the majority class to create a balanced dataset, then split.
Why it's wrong here
Undersampling may lose valuable information and still requires careful splitting.
- ✓
Use the scale_pos_weight parameter in XGBoost to assign higher weight to the minority class.
Why this is correct
This is the correct approach; it adjusts class weights without modifying the dataset.
- ✗
Oversample the minority class using SMOTE on the entire dataset before splitting into train/validation sets.
Why it's wrong here
SMOTE before split causes data leakage; the validation set may contain synthetic examples derived from training data.
- ✗
Randomly oversample the minority class by duplicating rows, then perform stratified train/test split.
Why it's wrong here
Duplication before split can leak the same rows into both training and validation.
Quick reference
AWS S3 Storage Class Comparison
| Storage Class | Min Duration | Retrieval | Use Case |
|---|---|---|---|
| S3 Standard | None | Immediate | Frequently accessed data |
| S3 Standard-IA | 30 days | Immediate | Infrequent access, rapid retrieval |
| S3 One Zone-IA | 30 days | Immediate | Non-critical infrequent data |
| S3 Intelligent-Tiering | None | Immediate–hours | Unknown or changing access patterns |
| S3 Glacier Instant | 90 days | Milliseconds | Archive with instant retrieval |
| S3 Glacier Flexible | 90 days | Minutes–hours | Archive, flexible retrieval |
| S3 Glacier Deep Archive | 180 days | Hours | Long-term compliance archive |
Go deeper
Related to this question
About these practice questions
One of 835 original MLA-C01 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This MLA-C01 practice question is part of Courseiva's free Amazon Web Services certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the MLA-C01 exam.